本文整理汇总了C#中IGrouping.Max方法的典型用法代码示例。如果您正苦于以下问题:C# IGrouping.Max方法的具体用法?C# IGrouping.Max怎么用?C# IGrouping.Max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGrouping
的用法示例。
在下文中一共展示了IGrouping.Max方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFirstCar
private static Car GetFirstCar(Tournament tournament, IGrouping<string, CarResult> classGroup)
{
var maxPoints = classGroup.Max(r => r.Points);
var carsWithMaxPoints = classGroup.Where(r => r.Points == maxPoints).ToArray();
if (carsWithMaxPoints.Count() == 1)
{
return carsWithMaxPoints.First().Car;
}
var tiebreakWinner = TiebreakWinner(tournament, classGroup);
if (tiebreakWinner == null)
{
return null;
}
return tiebreakWinner;
}
示例2: SaveGroupToFile
private static void SaveGroupToFile(IGrouping<decimal, Row> grouping)
{
var minRate = grouping.Min(row => row.Rate);
var maxRate = grouping.Max(row => row.Rate);//or grouping.Key
var fileName = string.Format("DailyCompounded_PaidWeekly_Principal1-10m_Rate{0}-{1}.csv",
minRate,
maxRate);
var csvLines = from row in grouping
orderby row.Rate, row.Principal, row.Term
select row.ToCsv();
var rows = Enumerable.Repeat(Row.CsvHeader, 1)
.Concat(csvLines);
File.WriteAllLines(fileName, rows);
//var binaryContents = SevenZipHelper.Decompress(zipConents);
var bytes = File.ReadAllBytes(fileName);
var compressed = SevenZipHelper.Compress(bytes);
File.WriteAllBytes(fileName +".lzma", compressed);
}
开发者ID:LeeCampbell,项目名称:ArtemisWest-Mayfair,代码行数:21,代码来源:DailyCompoundedPaidWeeklyDataLoaderFixture.cs