I have a list of employees, and all of them have another list nested which is called the DisplayList.
Now not all the employees have the same amount of DisplayFields. So I wish to get those with the highest DisplayFields, so that I can incorporate everyone in the display.
At the moment I have the following :-
            int iMaxDisplayCount = 0;
        foreach (Employee employee in employeeList)
        {
            int iDisplayCount = employee.EmployeeDisplayCollection.Count;
            if (iDisplayCount > iMaxDisplayCount)
                iMaxDisplayCount = iDisplayCount;
        }
        var employees = employeeList.GroupBy(p => p.EmployeeDisplayCollection.Count == iMaxDisplayCount).Select(g => g.ToList());  
        foreach(var employeeHighList in employees)
        {
            foreach (var employee in employeeHighList) 
            {         
            }         
        } 
however for some reason, I am getting all the employees in the employeeHighList and not just the ones who have the highest display count.
I think the GroupBy is not correct, but don't know what's wrong with it.
Any help will be very much appreciated!
Thanks
 
    