Accepted answer

Yes, you use Contains:

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


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


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)


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:

Related Query

More Query from same tag