Hierarchy from Flat Data
问题 I have an employee class that has an employeeId (int), parent(int) and children property List<Employee> . I get the employee list from the database in the correct order and now need to build the hierarchy , but I am failing miserably...I know this is programming 101, but I am having a hard time with it. public class Employee { public int EmployeeId { get; set;} public int ParentId;{ get; set;} public List<Employee> Children; { get; set;} } Data Example EmployeeId, ManagerId 1, 0 //no one 2, 1