using System.Collections.Generic;
public static void Main()
var amounts = new List<Amounts>{
new Amounts{Name = "Name1", Total = 31},
new Amounts{Name = "Name2", Total = 35},
new Amounts{Name = "Name3", Total = 32},
new Amounts{Name = "Name4", Total = 35}
var results = amounts.MaxsBy(x => x.Total);
Console.WriteLine(string.Join("\n", results.Select(x => x.Name)));
public static class Extensions
public static IEnumerable<TSource> MaxsBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource,TKey> keySelector)
return source.GroupBy(keySelector).MaxBy(g => g.Key);