How to add an in command to a where clause in LINQ? -


if have clause follows:

where item.field == "value" 

how can change statement in linq be:

   item.field in ("value1","value2","value3") 

seems simple, not working.

thanks in advance

declare "in" values collection in variable first:

var collection = new[] { "value1","value2","value3" }; 

and use in query:

... collection.contains(item.field) ... 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -