本文整理汇总了C#中IOrderedEnumerable.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IOrderedEnumerable.Select方法的具体用法?C# IOrderedEnumerable.Select怎么用?C# IOrderedEnumerable.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOrderedEnumerable
的用法示例。
在下文中一共展示了IOrderedEnumerable.Select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayPackageViewModel
public DisplayPackageViewModel(Package package, IOrderedEnumerable<Package> packageHistory, bool isVersionHistory)
: base(package)
{
Copyright = package.Copyright;
if (!isVersionHistory)
{
Dependencies = new DependencySetsViewModel(package.Dependencies);
PackageVersions = packageHistory.Select(p => new DisplayPackageViewModel(p, packageHistory, isVersionHistory: true));
}
DownloadCount = package.DownloadCount;
LastEdited = package.LastEdited;
if (!isVersionHistory && packageHistory.Any())
{
// calculate the number of days since the package registration was created
// round to the nearest integer, with a min value of 1
// divide the total download count by this number
TotalDaysSinceCreated = Convert.ToInt32(Math.Max(1, Math.Round((DateTime.UtcNow - packageHistory.Last().Created).TotalDays)));
DownloadsPerDay = TotalDownloadCount / TotalDaysSinceCreated; // for the package
}
else
{
TotalDaysSinceCreated = 0;
DownloadsPerDay = 0;
}
}
示例2: BurrowsWheelerTransform
internal BurrowsWheelerTransform(IOrderedEnumerable<int[]> transform)
{
var y = transform.Select(v => new { F = v[0], L = v[2], S = v[1] }).ToArray();
sorted = y.Select(v => v.F).ToArray();
bwt = y.Select(v => v.L).ToArray();
suffix = y.Select(v => v.S).ToArray();
index = suffix.Select((s, i) => new { S = s, I = i }).OrderBy(v => v.S).Select(v => v.I).ToArray();
}
示例3: Print
private static void Print(IOrderedEnumerable<A> result)
{
var output = result.Select(a =>
{
Console.WriteLine(a.S);
return a.S;
});
}
示例4: MeansOfTransportAsString
public string MeansOfTransportAsString(IOrderedEnumerable<TransportMethod> meansOfTransport)
{
if (meansOfTransport == null || !meansOfTransport.Any())
{
return string.Empty;
}
return string.Join("-", meansOfTransport.Select(m => EnumHelper.GetShortName(m)));
}
示例5: AddLinkedChain
public FromComprenoModel AddLinkedChain(Compreno.SentenceElement master, IOrderedEnumerable<Compreno.SentenceElement> dependantWords)
{
var linkedChain = new LinkedChain();
linkedChain.Master.Words.Add(_toSentenceWord(master));
linkedChain.Dependent.Words.AddRange(dependantWords.Select(_toSentenceWord));
_comparisonSentence.LinkedChains.Add(linkedChain);
return this;
}
示例6: AddSimpleSentence
public FromComprenoModel AddSimpleSentence(IOrderedEnumerable<Compreno.SentenceElement> words)
{
var simpleSentece = new SimpleSentence();
simpleSentece.Words.AddRange(words.Select(_toSentenceWord));
_comparisonSentence.SimpleSentences.Add(simpleSentece);
return this;
}
示例7: CheckFirstMainWrite
private static void CheckFirstMainWrite(IOrderedEnumerable<KeyValuePair<string, string>> data)
{
if (firstMainWrite && _mainLogger.IsInfoEnabled)
{
lock (firstMainWriteLock)
{
if (firstMainWrite)
{
_mainLogger.Info(string.Join(";", data.Select(kvp => kvp.Key).ToArray()));
firstMainWrite = false;
}
}
}
}
示例8: Swiss
/// <summary>
/// Pairs the players against each other in swiss format, e.g. top player plays
/// against the second, third against the fourth and so on. Avoids creating the
/// same pairing twice. See the PairingAlgorithm.txt document for details.
/// </summary>
public IEnumerable<Pairing> Swiss(IOrderedEnumerable<KeyValuePair<Player, int>> standings, IList<Pairing> history)
{
ValidatePlayerCount(standings.Select(i => i.Key));
var players = standings.OrderByDescending(i => i.Value).Select(i => i.Key).ToList();
var pairings = new Stack<Pairing>();
var timer = Stopwatch.StartNew();
while (!AllPlayersPaired(pairings, players))
{
TryAddPairing(pairings, players, history);
if (timer.ElapsedMilliseconds > SwissTimeout)
{
throw new TimeoutException("The requested operation took too long to complete.");
}
}
return pairings.ToArray().Reverse();
}
示例9: GetMatchStats
private MatchStats[] GetMatchStats(IOrderedEnumerable<MatchScore> orderedMatches)
{
IEnumerable<MatchStats> matchStats = orderedMatches.Select(x => x.MatchStats);
MatchStats[] matchStatsArray = matchStats.ToArray();
return matchStatsArray;
}
示例10: Create
public static ActivitiesViewModel Create(ActivityQuery query, IOrderedEnumerable<Application> applications)
{
var model = Mapper.Map<ActivitiesViewModel>(query);
var list = new List<SelectListItem>
{
new SelectListItem
{
Selected = query.ApplicationId == null,
Text = String.Empty,
Value = null
}
};
list.AddRange(applications.Select(x => Create(query, x)));
model.Applications = list;
return model;
}
示例11: LoadInfo
private void LoadInfo()
{
if (_selectedType != _loadedInfoForType) {
_collection =
typeof(GameState).GetMethod("FetchAll")
.MakeGenericMethod(_selectedType)
.Invoke(null, new object[] { false }) as IList;
_props = _selectedType.GetProperties().OrderBy(prop => prop.Name);
_headers = _props.Select(prop => {
var header = new TableHeader { Label = prop.Name, Width = 100 };
switch (header.Label) {
case "_Id":
header.Label = "ID";
header.Width = 23;
break;
case "_EditorId":
header.Label = "Editor ID";
break;
}
return header;
}).ToArray();
_loadedInfoForType = _selectedType;
}
}
示例12: OrderProduct
private static OrderLine OrderProduct(int productId, IOrderedEnumerable<int> variants, int itemCount, OrderInfo order)
{
var currentLocalization = StoreHelper.CurrentLocalization;
var productService = IO.Container.Resolve<IProductService>();
var productInfo = productService.CreateProductInfoByProductId(productId, order, currentLocalization, itemCount);
if (variants != null && variants.Any())
{
var productVariantService = IO.Container.Resolve<IProductVariantService>();
var variantClasses = variants.Select(variant => productVariantService.GetById(variant, currentLocalization)).Where(variant => variant != null).GroupBy(a => a.Group).Select(g => g.FirstOrDefault()).Where(variant => variant != null);
productInfo.ProductVariants = variantClasses.Select(variant => new ProductVariantInfo(variant, productInfo, itemCount)).ToList();
}
return new OrderLine(productInfo, order);
}
示例13: ParseToHighChart
public HighChart ParseToHighChart(IOrderedEnumerable<ScoreList> source)
{
var hiChart = new HighChart();
if(source.Any())
{
hiChart.Name = source.First().Title;
hiChart.Data = source.Select(s => ParseDateAndNumber(s.Date, s.Popular)).ToList();
}
return hiChart;
}
示例14: CheckFirstObjectWrite
private static void CheckFirstObjectWrite(IOrderedEnumerable<KeyValuePair<string, string>> data)
{
if (firstObjectWrite)
{
lock (firstObjectWriteLock)
{
if (firstObjectWrite)
{
_objectsLogger.Info("name;" + string.Join(";", data.Select(kvp => kvp.Key).ToArray()));
firstObjectWrite = false;
}
}
}
}
示例15: CreateParameters
/// <summary>
/// Create the display model from the parameter model.
/// </summary>
/// <param name="parameterModel">The parameters in the model</param>
/// <returns>An observable collection of the parameters using the display model</returns>
internal static ObservableCollection<ParameterDisplayModel> CreateParameters(IOrderedEnumerable<ParameterModel> parameterModel)
{
return new ObservableCollection<ParameterDisplayModel>(parameterModel.Select(p => new ParameterDisplayModel(p)));
}