How can I get the maximum element(the object itself) in each group, rather than the number itself? I can only get the maximum value, not the object
var maxValue = order.GroupBy(a => a.username).Select(a=>(a.Key, a.Max(k=>k.count)));
Console.WriteLine("Max group = " + maxValue);