vb.net - linq to dataset contains or any -
i'm trying solve problem, no success now.
i have datatable 3 fields: f1, f2, f3 (string, string, double).
i write linq query, makes following: selects rows, of values of f1 doesn't match f2 values. in other words, f2 values, doesn't occur in f1 field values.
how should combine where, any, contains keywords?
try using linq extension function groupjoin
dim dt datatable 'your datatable dim uusi ienumerable(of datarow) = dt.asenumerable() _ .groupjoin(of datarow, string, datarow)(dt.asenumerable(), function(dr) dr.field(of string)("f1"), function(dr) dr.field(of string)("f2"), function(row, matched) if matched.count > 0 return nothing end if return row end function) _ .where(function(row) row isnot nothing)
groupjoin
method find matched rows given values (lambdas in second , third parameter)
last parameter lambda/method created result collection,
there check if collection of matched rows empty
, where
function remove null rows collection
Comments
Post a Comment