Is there an equivalent of a SQL IN statement in LINQ to objects?
Share
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.
Yes – Contains.
(In LINQ to SQL this ends up as an ‘IN’ query.)
Note that in LINQ to Objects the above isn’t really very efficient. You’d be better off with a join:
(This could still be done with dot notation of course, but it ends up being somewhat messier.)