Linq.Where-to-SQL on a text field comparing to a list of values

Posted by StampedeXV on Stack Overflow See other posts from Stack Overflow or by StampedeXV
Published on 2010-04-06T15:19:53Z Indexed on 2010/04/06 15:33 UTC
Read the original article Hit count: 162

Filed under:
|
|

Customer.text is a field in an T-SQL DB (that I do not control and thus may not alter) of type "text".

I'd like to do something like this:

List<string> compare = new List<string>();
compare.Add("one");
compare.Add("two");

var q = from t in customer
        where t.text.Contains( compare.First())
        select t;

this will work.

But now I'd like to do something like: (!NOT WORKING!)

var q = from t in customer
        where compare.Contains( t.text )
        select t;

How can I achieve this? Is it even possible?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about sql