There is an organisation with several departments and each department has a few employees.
I have created the following object model:
public class O
I know this is an old question, but there's a simpler way of achieving the same result:
organisations = organisations.OrderBy(org =>
{
org.Departments = org.Departments
.OrderBy(dept =>
{
dept.Employees = dept.Employees
.OrderBy(employee => employee.Code)
.ThenBy(employee=>employee.Name);
return dept.Code;
})
.ThenBy(dept=>dept.Name);
return org.Code;
})
.ThenBy(org=>org.Name);