LINQ - array property contains element from another array

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-03-29T16:09:25Z Indexed on 2010/03/29 16:13 UTC
Read the original article Hit count: 420

Filed under:
|
|

I have a object (product), with a property of type 'array' e.g. product.tags = {"tag1","tag2","tag9"}

I have an array of input tags to filter on.

... but this is not quite working:

List<string> filterTags = new List<string>() { "tag1", "tag3" };

var matches = from p in products
  where p.Tags.Contains(filterTags)
  select p;

Any recommendations? Thanks.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about filter