Reputation: 43813
Say I want to pass an array of integers into a method that runs some LINQ to SQL, how would I say something like "where SuchID is in array[] select"?
Upvotes: 5
Views: 1490
Reputation: 241611
Use Contains
.
int[] ids = // populate ids
var query = from e in db.SomeTable
where ids.Contains(e.SuchID)
select e;
LINQ to SQL will translate this to a WHERE
clause using IN
.
Upvotes: 10