score:15

Accepted answer

Yes, you use Contains:

db.Products.Where(product => myFields.Contains(product.Category))

aka

from product in db.Products
where myFields.Contains(product.Category)
select product

score:0

In theory you would use contains:

var productList = from product in context.Products
    where myfields.contains(product.category)
    select product

However you'll need to test this - I seem to recall there being a bug in the Linq2Sql optimizer when trying to deal with List<> and array values being used like this (it may have only occured if you tried to cast them as IQueryable)

score:1

As other have mentioned, yes it does using the .Contains method. To benefit the other random people that may arrive here via Bing (or any of the other search engines): Linq-To-Entities does not support the .Contains method in the current version. However, with a simple extension method, you can do so:
http://george.tsiokos.com/posts/2007/11/30/linq-where-x-in/


Related Articles