从DataView的列中选择不同的值.
问题描述:
亲爱的朋友,
我必须从DataView的列中选择不同"值.
我也想从数据视图中删除空行....
请朋友帮我...
在此先感谢
Dear friends,
I have to select "Distinct" Values from a column in DataView.
Also I want to remove empty rows from the dataview....
Please friends help me ...
Thanks in advance
答
您可以为此使用Lambda表达式.
假设要从网格中获取的数据为int类型.
然后,初始化List< int> ;,例如 List< int> list =新列表< int>
然后将列的所有行添加到此列表.
然后尝试 list.Distinct().ToList()
此列表将提供所需的不同值
快乐编码
:)
Hi,
You can use Lambda Expression for this.
Suppose the data you want to get from the grid is of type int.
Then initialize a List<int>, like List<int> list = new List<int>
Then add all the rows of the column to this list.
Then try list.Distinct().ToList()
This list will give the required distinct values
Happy Coding
:)