Linq check to see is there any NULLs in a set of DataRows? -


i have set datarows , want check if of fields in of rows has null value in it. came below, i'm not sure because i'm nesting all.

result.asenumerable().asqueryable().all(o => o.itemarray.all(i=>i == dbnull.value)) 

hard tell because can't put "watch" in lambdas.

actually need use any (in code return true if values null) , asqueryable() useless in case.

bool nullfound = result.asenumerable()                        .any(o => o.itemarray.any(i=>i == dbnull.value || == null)); 

then, if need list of rows value null, following:

var rowswithnulls = result.asenumerable()                          .where(o => o.itemarray.any(i=>i == dbnull.value || == null))                          .tolist(); 

p.s.

i added null check more safe, if sure have dbnull.value, can remove it.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -