Archive for August, 2012
Following my last post on benchmarking madness, here is a short one about finding .net classes or interfaces based on given criteria.
While writing my last post, I found myself having a hard time searching for classes implementing
IEnumerable<T> without also implementing
String, there is not so many…
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.