The best way to get a count of IEnumerable

前端 未结 11 1426
悲哀的现实
悲哀的现实 2020-12-14 15:47

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 LIN

11条回答
  •  无人及你
    2020-12-14 16:09

    There's also IList or ICollection, if you want to use a construct that is still somewhat flexible, but also has the feature you require. They both imply IEnumerable.

提交回复
热议问题