c# - Need a linq query where inclusion indicates property matches all values in secondary list -


i want duplicate following logic in single query.

var currentrows = resultstable.asenumerable(); foreach (var wholeword in excludewholewords) {     currentrows = row in currentrows         !foundwholeword(wholeword, row.field<string>("busdescl"))         select row;  } resultstable = currentrows.copytodatatable(); 

i had tried following, results in matching if !foundwholeword true wholeword, instead of intent (which match means !foundwholeword true items in excludewholewords

var matchgvrows = (from wholeword in excludewholewords   row in gvkeystable.asenumerable()   !foundwholeword(wholeword, row.field<string>("busdescl"))   select row).distinct(); 

any ideas?

if understand question correctly, should along lines of:

var newrows = currentrows   .where(r => !excludewholewords.any(w => w == r.field<string>("busdescl")); 

i don't know foundwholeword if different comparing strings, can use like:

var newrows = currentrows   .where(r => !excludewholewords.any(w => foundwholeword(w, r.field<string>("busdescl"))); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -