[Solved] LINQ: Howto get person count by personid [closed]
Max : var biggestGrpOfPeopleHavingSamePersonId = people.GroupBy(x => x.personid).Max(x => x.Count()); Top : var top3peopleGroups = people.GroupBy(x => x.personid).OrderByDescending(x => x.Count()).Take(3); EDIT : The first query returns an element of type IGrouping<TKey,TValue> where TKey is of the same type of personid and TValue is of type Person. The second query returns an IEnumerable<> of objects like … Read more