LINQ None method (aka !Any) #54743
Answered
by
stephentoub
maxkoshevoi
asked this question in
Ideas
-
I'm sure, this question was already raised here, but I couldn't find it. Main reason is that I see good amount of code that checks for empty collections like this. Which is not very readable. if (!someLongCollectionName.Any()) As for other benefits. Third condition reads much better: !arr.Any(i => i == 5)
arr.All(i => i != 5)
arr.None(i => i == 5) |
Beta Was this translation helpful? Give feedback.
Answered by
stephentoub
Jun 25, 2021
Replies: 1 comment 2 replies
Answer selected by
maxkoshevoi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#27661