A collegue of mine needed an algorithm to filter out duplicate objects in a List and count the total occurence of each distinct object. He used this query to get his results, it may be usefull to some of you.
myRoles = from c in allRoles
group c.RoleId
by new { c.PersonId, c.RoleTypeId }
into g
orderby g.Count() descending
select g;
Credits go to Roel Dieltjens
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
Development