I have an IEnumerable that has a list of objects with identifiers. I want to select those objects whose identifiers are 1, 2, 7, 8, 9, 10 and 11. I do not know the LINQ / Lambda equivalent of the equivalent SQL statement (select *, where id in (1, 2, 7, 8, 9, 10, 11)).
I tried something like:
var movieratings = new int[] {1, 2, 7, 8, 9, 10, 11}; list.ratings= list.ratings.Select(x => movieratings.Contains(x.Value));
But this gives me a compilation error, for example, saying that type arguments cannot be taken out of use.
source share