How can I select multiple elements using a WHERE…IN… type of clause as in
select * from orders where orderid in (1, 4, 5)
in LinqToSql? I’d prefer not to have a lambda expression since they scare me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
LINQ has ‘Contains’ which is like ‘IN’ but expressed the other way round – an element isn’t ‘in’ a set, a set ‘contains’ an element.
This is more simply expressed (IMO) with a lambda though:
I realise lambdas are ‘new’ and therefore scary to some extent, but it’s really well worth grabbing hold of them with both hands. They’re lovely.