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"?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With