我有一个返回的 LINQ 查询IEnumerable<List<int>>
但我只想返回List<int>
所以我想将我的所有记录合并到我的IEnumerable<List<int>>
仅一个数组。
例子 :
IEnumerable<List<int>> iList = from number in
(from no in Method() select no) select number;
我想拿走我所有的结果IEnumerable<List<int>>
只给一个List<int>
因此,从源数组:[1,2,3,4]
and [5,6,7]
我只想要一个数组[1,2,3,4,5,6,7]
Thanks
Try SelectMany() http://msdn.microsoft.com/en-us/library/system.linq.enumerable.selectmany.aspx
var result = iList.SelectMany( i => i );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)