本文介绍了获得IEnumerable< T>的最佳方法是使用IEnumerable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在不枚举IEnumerable集合中所有项目的情况下,最好/最简单的方法是什么?
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?
LINQ或Lambda可以使用吗?
Possible with LINQ or Lambda?
推荐答案您将必须枚举计数.诸如List之类的其他结构仍在不断计数.
You will have to enumerate to get a count. Other constructs like the List keep a running count.
更多推荐
获得IEnumerable< T>的最佳方法是使用IEnumerable
发布评论