linq - In C#, how can I order a list after its grouped by size of the list? -


lets have collection of car objects

3 blue cars
10 yellow car
5 red cars

list<car> cars = getlist(); var groupby = cars.groupby(r=>r.color); 

i want sort groupby grouped collection in descending order first yellow cars, red , blue when loop through list

what correct way sort grouped list size of collection in entry of group list?

var result = cars.groupby(r=>r.color).orderbydescending(g => g.count()); 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -