public static void Main()
new Person("Simon", 175),
new Person("Bertil", 165),
new Person("Daniel", 175),
new Person("Lennart", 144)
var mostCommonLength = people.GroupBy(x => x.Length).Select(x => new { Length = x.Key, Count = x.Count() }).OrderByDescending(x => x.Count).FirstOrDefault().Length;
Console.WriteLine(mostCommonLength);
var mostCommonNameInMostCommonLength = people.GroupBy(x => x.Length).Select(x => new { Length = x.Key, Name = x.GroupBy(y => y.Name).Select(y => new { Name = y.Key, Count = y.Count() }).OrderByDescending(y => y.Count).FirstOrDefault().Name }).OrderByDescending(x => x.Length).FirstOrDefault().Name;
Console.WriteLine(mostCommonNameInMostCommonLength);
public Person(string name, int length)
public string Name { get; }
public int Length { get; }