c# - Order List By Distinct And Object Property Larget value -
i need arrange list have distinct object items largest object x property. example: have list of objects: mylist : object[0] : name: dani x:3; object[1] : name:dani; x:1; object[2]: name:joey; x:5; object[3]: name:joey; x:1; i need find distinct objects largest x values new list 2 objects so: new list: object[0] :name:dani;x:3 object[1] :name:joei;x:5 how can find new list? lambda ex nice... myobjects.groupby(o => o.name).select(g => g.orderbydescending(o => o.x).first()) seeing don't provide details of linq provider using, best general approach. can speed things in linq2objects using maxby extension method in morelinq : http://code.google.com/p/morelinq/ myobjects.groupby(o => o.name).select(g => g.maxby(o => o.x))