本文介绍了排序列表< DataRowView>一栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我有一个绑定到DataTable的BindingSource
然后我用所有的填充DataRowView(MyList)列表来自BindingSource的行。
现在我需要使用特定的列索引对MyList进行排序
如何做?
注意,我无法对BindingSource进行排序,因为MyList是另一个对象的属性
解决方案
您是否尝试过这样的代码? : 'sorted_list = MyList.OrderBy(r => r [columnIndexOrName])。ToList()'?
Hi all
I Have a BindingSource bound to DataTable
Then I fill a List of DataRowView (MyList) with all the rows coming from BindingSource.
Now I need to sort MyList with a specific Column index
How to do that ?
Note, I cannot sort BindingSource since MyList is a property of another object
解决方案Did you try a code like this: ‘sorted_list = MyList.OrderBy( r => r[columnIndexOrName] ).ToList()’?
更多推荐
排序列表< DataRowView>一栏
发布评论