SyntaxFix
Write A Post
Hire A Developer
Questions
var query = list.Where(r => listofIds.Any(id => id == r.Id));
Another approach, useful if the listOfIds array is large:
HashSet<int> hash = new HashSet<int>(listofIds); var query = list.Where(r => hash.Contains(r.Id));