I have a mock application where an inheritance chain like
Employee,Manager,President
etc.
The Employee class looks like
class Employee
{
1) It depends on where the data is coming from. A database, file from disk, in memory collection. Often the List
or whatever structure is determined by the source.
2) Your LINQ is getting the max number, not the Manager
with the highest count. Try:
public static Manager GetBestManager(List managerList)
{
Manager m = managerList.OrderByDescending(x => x.EmployeesManaged.Count).First();
return m;
}