分类:
ASP.NET
转载:https://www.itranslater.com/qa/details/2125804226692514816
我有关于IGrouping和Select()方法的问题。
可以说我用这种方式得到了List<smth>:
列表是List<smth>。
现在我需要以某种方式将每个List<smth>的值传递给另一个列表:
在这种情况下,有人可以建议如何从IGrouping<int, smth>获得价值(List<smth>)吗?
Illia Ratkevych asked 2019-04-25T22:50:18Z
4个解决方案
213 votes
自IGrouping<TKey, TElement>实施IEnumerable<TElement>,您可以使用SelectMany将所有IEnumerables全部放回一个IEnumerable:
27 votes
首先,您需要选择所需的组。 然后你可以使用组中的ToList方法。 IGrouping是一个IEnumerable的价值观。
11 votes
从IGrouping的定义:
你可以迭代这样的元素:
9 votes
上述答案的更明确版本:
评价
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256
50010702506256
欢迎加群交流技术