linq where list contains any in list

c#, linq

Solution

Sounds like you want:

var movies = _db.Movies.Where(p => p.Genres.Intersect(listOfGenres).Any());

Problem

Using linq, how can I retrieve a list of items where its list of attributes match another list? Take this simple example and pseudo code: ``` List<Genres> listofGenres = new List<Genre>() { "action", "comedy" }); var movies = _db.Movies.Where(p => p.Genres.Any() in listofGenres); ```

Original source