-1

I need to filter entity with LINQ by collection of IDs. What I am trying to do better explains following sql query:

 select * from Person where PersonID in (1,2,3)

I have List collection which contain collection of IDs and need to retrieve all persons with same ID like in collection.

Thanks

kat1330
  • 5,134
  • 7
  • 38
  • 61

1 Answers1

2
myList.Where(item => ids.Contains(item)).ToList()
Valentin P.
  • 1,131
  • 9
  • 18