2

是否有一种简单的方法可以将remaining以下代码转换为一维数组。

var groups = data.OrderBy(d => d.Time).GroupBy(d => d.Period);
var first = groups.First().ToArray();
var remaining = groups.Skip(1).??
4

2 回答 2

5
var remaining = groups.Skip(1).SelectMany(g=>g).ToArray();
于 2013-10-25T13:28:15.863 回答
2

用于SelectMany“展平”集合的集合:

var remaining = groups.Skip(1).SelectMany(d => d).ToArray();
于 2013-10-25T13:28:56.250 回答