如何从VB.net中的Datatable中选择包含我的自定义对象的所有行? - 实际上它的类型是INotifyPropertyChanged
我考虑将datatable.select
方法与过滤器表达式一起使用,但不知道比较如何与select一起使用。
答案 0 :(得分:0)
尝试使用LINQ的Where
方法,例如,
' this will return a list of DataRow object
Dim rows = datatable.AsEnumerable().Where(Function(x) TypeOf x("mycolumn") Is INotifyPropertyChanged).ToList()
OR
' this will return a new DataTable with your selected rows
Dim dt2 = datatable.AsEnumerable().Where(Function(x) TypeOf x("mycolumn") Is INotifyPropertyChanged).CopyToDataTable()