Sean Chambers Sean Chambers - 1 year ago 105
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download