Sean Chambers Sean Chambers - 7 months ago 70
C# Question

The best way to get a count of IEnumerable<T>

Whats the best/easiest way to obtain a count of items within an IEnumerable collection without enumerating over all of the items in the collection?

Possible with LINQ or Lambda?


you will have to enumerate to get a count. Other constructs like the List keep a running count.