Random Thoughts And Coding
Archive for August, 2012
How to find all implementations of IEnumerable not implementing ICollection
Aug 12th
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 ICollection<T>.
Indeed, beside String, there is not so many…
More >
Benchmarking madness: IEnumerable
Aug 12th
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.
More >
