【发布时间】:2018-12-06 13:41:30
【问题描述】:
我的输入在xml文件下面
<Employees>
<Department Position="9">
<Employee No="7" Status="True" />
<Employee No="6" Status="True" />
<Employee No="8" Status="True" />
</Department>
<Department Position="4">
<Employee No="7" Status="True" />
<Employee No="8" Status="True" />
<Employee No="6" Status="True" />
</Department>
</Employees>
Out put should be sorted by department position and employee "No"
<Employees>
<Department Position="4">
<Employee No="6" Status="True" />
<Employee No="7" Status="True" />
<Employee No="8" Status="True" />
</Department>
<Department Position="9">
<Employee No="6" Status="True" />
<Employee No="7" Status="True" />
<Employee No="8" Status="True" />
</Department>
我添加了下面的代码,但它会返回“位置”或“否”,但不能同时返回。
var sortSignalList = new Dictionary<int, List<string>>();
sortSignalList.OrderBy(x => x.Position).OrderBy(x=>x.No).ToList();
【问题讨论】: