我如何找到每个部门的平均工资?
var employees = new List<Employee>
{
new Employee {Name = "Tom", Age = 32,Department = "Design",Salary=120000},
new Employee {Name = "John", Age = 22,Department = "UI",Salary=86000},
new Employee {Name = "Sandra", Age = 36,Department = "UI",Salary=83000},
new Employee {Name = "Julie", Age = 54,Department = "Javascript",Salary=80000},
new Employee {Name = "Samantha", Age = 21,Department = "Design",Salary=125000}
};
var massagedEmployees = employees.GroupBy(e => e.Department).Select(g=>g.??????
在 SQL 中,我会做类似的事情
select Department,avg(salary) from Employees group by Department