is there any functional difference between:
if (photos.Any(it => it.Archived))
and
if (photos.Where(it => it.Archived).Any())
if so, is there a more compelling reason to use one over the other?
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.
Functionally they do the same thing. The performance depends on the specific provider, but for example in LINQ to SQL both forms produce the exact same SQL:
If I have to pick one I’d use the first option as it seems slightly more clear to me.