1

我有一个清单

List<List<Employee>> EmployeeListCollection;

并且想要

List<Employee> EmployeeList=//all employee in EmployeeListCollection

什么是查询?

4

2 回答 2

12
List<Employee> EmployeeList = EmployeeListCollection.SelectMany(c => c).ToList();
于 2012-08-07T07:19:38.727 回答
0

尝试这个:

List<List<Employee>> EmployeeListCollection;
List<Employee> EmployeeList;
foreach(var emplst in EmployeeListCollection)
{
  foreach(var emp in emplst )
 {
     EmployeeList.add(emp);
 }
}
于 2012-08-07T11:08:44.720 回答