There is in operator in SQL
SELECT * FROM MyTable WHERE id IN (1, 2, 3, 4, 5)
Is there similar sintax in C#, I mean
if(variable in (1, 2, 3, 4, 5)){
}
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.
There isn’t a good one but you can write it yourself as an extension method:
I haven’t tested it, but it should be good.
UPDATE: As suggested by OP, I’ve corrected a few typos.