My input is below xml file
<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>
I have added below code but it returns either "position" wise or "No" wise but not both.
var sortSignalList = new Dictionary<int, List<string>>();
sortSignalList.OrderBy(x => x.Position).OrderBy(x=>x.No).ToList();
sortSignalList.OrderBy(x => x.Position).ThenBy(x=>x.No).ToList();
尝试....
sortSignalList.OrderBy(x => x.Position).ThenBy(x=>x.No).ToList()
列表也可以排序然后再降序
var thenByDescResult =sortSignalList.OrderBy(s => s.Position).ThenByDescending(s => s.No);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.