What is the most performant way in Linq to write:
return enumerable.Count() > x;
I'm at least looking for a solution that:
- doesn't involve counting out the whole enumerable.
- preferably standard .NET Linq.
- should work on different providers.
Note that enumerable.Any()
works really well for more then 0, but I'm looking for a solution that checks for more than x
.
Example:
Think of a very large enumerable that is build with yield return
.