LINQ中的扁平列表

LINQ中的扁平列表

我有一个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]和[5,6,7]

我只想要一个数组[1,2,3,4,5,6,7]

谢谢


MMMHUHU
浏览 413回答 3
3回答

泛舟湖上清波郎朗

使用查询语法:var&nbsp;values&nbsp;=from&nbsp;inner&nbsp;in&nbsp;outerfrom&nbsp;value&nbsp;in&nbsp;innerselect&nbsp;value;

HUH函数

使用查询语法:var&nbsp;values&nbsp;=from&nbsp;inner&nbsp;in&nbsp;outerfrom&nbsp;value&nbsp;in&nbsp;innerselect&nbsp;value;
打开App,查看更多内容
随时随地看视频慕课网APP