I need to find the person who has the maximum items in a list like this:
class Person
{
var personid;
var personname;
var blah;
}
List<Person> people = new List<Person>();
Sample list
1 John
1 John
1 John
2 Smith
1 John
Sample result
1 3 (id, count)
Sample bonus result -with Top N clause
1 3
2 1
Plus; Top N clause would be nice if any/built-in. I would like to learn both versions; with or without Top clause.