获得IEnumerable< T>的最佳方法是使用IEnumerable

编程入门 行业动态 更新时间:2024-10-12 08:25:51
本文介绍了获得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

本文发布于:2023-11-07 19:27:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567217.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方法   amp   IEnumerable   gt   lt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!