Linq Query to return false even if one row dont have matching record


I have a data table.
I have to return false if even one row doesnt fulfil the condtion.

Condition. Col1 = Abc and Col3 = Yes
should return true if all the rows of the data table matches this codntion.Even when one row doesnt have the condition matched then return false.
Can you please help with Linq Query.

Col1 Col2 Col3
Abc Apple Yes
Abc Bat Yes
Abc Cat Yes

Hi @JITU99 ,

Could you try with the below Expression :

DT.AsEnumerable.All(Function(x)x("Col1").ToString.Equals("Abc") andAlso x("Col3").ToString.Equals("Yes"))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.