Posts tagged optimization
What is the best way to know if an
IEnumerable<T> contains at least one element?
I mean, what is the most optimized way to know this information?
Maybe the first thing that came to my mind was to do some
.Count() > 0 check, but if you think of it, the
Count() extension method would have to enumerate the entire collection to know its length. This seems a little overkill.