Find max count of a list of custom types

后端 未结 4 2058
耶瑟儿~
耶瑟儿~ 2021-01-24 12:03

I have a mock application where an inheritance chain like Employee,Manager,President etc.

The Employee class looks like

class Employee
    {         


        
4条回答
  •  梦毁少年i
    2021-01-24 12:07

    Quick and perhaps dirtier solution that works:

    return managerList
           .OrderByDescending(x => x.EmployeesManaged.Count)
           .FirstOrDefault();
    

提交回复
热议问题