What’s better?
1) several Where clauses with one filter per clause
2) 1 Where clause with lots of && between filters
I’m using linq-to-sql
Thanks.
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.
In linq-to-objects multiple
&&is most likely faster since it incurs the delegate invocation overhead only once.For most IQueryable based linq implementations it’s probably almost the same for both of them, since they most likely will be optimized to the same internal query. The amount of work done by the optimizer might differ slightly.