C# 按降序排列的OrderBy可观察集合-UWP
我可以使用下面的代码通过我的可观察集合进行订购。我怎样才能按降序排序呢C# 按降序排列的OrderBy可观察集合-UWP,c#,sorting,uwp,observablecollection,C#,Sorting,Uwp,Observablecollection,我可以使用下面的代码通过我的可观察集合进行订购。我怎样才能按降序排序呢 RollNoArray _mainItems = new RollNoArray(); _mainItems.SubItemsList = new ObservableCollection<SubItems>(); //..adding data to _mainItems.SubItemsList here _mainItems.SubItemsList = new ObservableCol
RollNoArray _mainItems = new RollNoArray();
_mainItems.SubItemsList = new ObservableCollection<SubItems>();
//..adding data to _mainItems.SubItemsList here
_mainItems.SubItemsList = new ObservableCollection<SubItems>
(from i in _mainItems.SubItemsList orderby i.num select i);// order by num
rollnarray\u main items=new rollnarray();
_mainItems.SubItemsList=新的ObservableCollection();
//…将数据添加到此处列出的_mainItems.subitems
_mainItems.SubItemsList=新的ObservableCollection
(从_mainItems.SubItemsList orderby i.num选择i中的i);//按数字排序
使用LinqOrderByDescending代替OrderBy:
_mainItems.SubItemsList.OrderByDescending(i => i.num).ToList();
从i in _mainItems.subitems按i.num排序
降序选择i