>int NumEmployees = 4; > >GridView1.DataSource = (from department in dbContext.Department > where department.Employee.Count > NumEmployees > orderby department.Name > select new > { > Name = department.Name , > Employees = department.Employee // this is a collection. > }).ToList(); >>
dbContext.Department.Where(w=>w.Employee.Count > NumEmployees) .OrderBy(o=>o.department.Name) .Select(s => new {Name = s.Department.Name, Employees = s.Department.Employee}) .ToList();