Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how get the list on group by and sort the grouped list based on containing row count in linq.

how can i do this. please help

What I have tried:

var add = attributeValue.OrderByDescending(x => x.AttributeID.Count()).GroupBy(x => x.AttributeID).ToList();
Posted
Updated 21-Aug-17 23:25pm

1 solution

Not sure what you data is but this may be what you are looking for:
C#
var add = attributeValue.GroupBy(x => x.AttributeID)
                        .OrderByDescending((x) => x.Count());
 
Share this answer
 
Comments
Member 10371658 23-Aug-17 8:47am    
yes, it's working, which is i am expecting.

thanks a lot.
Graeme_Grant 23-Aug-17 8:49am    
you're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900