LINQ: Entity string field contains any of an array of strings?

Since you want to see if search contains a word which is contained in the description of p you basically need to test for each value in search if it is contained in the description of p result = from p in products where search. Any(val => p.Description. Contains(val)) select p This is c# syntax for the lambda method since my vb is not that great.

Since you want to see if search contains a word which is contained in the description of p you basically need to test for each value in search if it is contained in the description of p result = from p in products where search. Any(val => p.Description. Contains(val)) select p; This is c# syntax for the lambda method since my vb is not that great.

Brilliant! It worked. VB syntax is: search.

Any(Function(n) p.Description.ToLower. Contains(n)) – Steve Macdonald Nov 18 '09 at 16:45 When I try to do this, I get "Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context." my "search" is a List and my "description" is also a string.

– Victor Rodrigues Jan 15 '10 at 20:01.

Dim result = From p in products _ Where search. Any(Function(s) p.Description. Contains(s)) Select p.

Damn you stole my first ever VB. NET answer! ;p +1 anyways – leppie Nov 18 '09 at 16:25 @leppie: Yeah, this is one of my few VB.NET answers.

– Jason Nov 18 '09 at 16:26.

You have it the wrong way around :) It should be: Where search. Contains(p. Description).

No, description should CONTAIN any element of search as a substring, not actually be one of them. – Victor Rodrigues Jan 19 '10 at 18:34.

Description property contains any of the words in a string array. I already looked at this similar question but couldn't get it to work.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions