Deal with it or don't
Obvious Extension Methods: IEnumerable AnyAndAll
This might not be intuitive to you (it wasn’t to me)
What does the following line return?
Enumerable.Empty<string>().All(t => t == "I don't think so")
…or maybe this would even be more confusing:
Enumerable.Empty<string>().All(t => t != t)
Well… both of those return true. (See Vacuous Truth)
I didn’t want to have to tack a call to Any() in my code for this situation, so I wrote AnyAndAll (which also performs better since it won’t even begin to enumerate the list twice.
Here it is: