是否有一种简单的方法可以将以下代码中的remaining
转换为1-D数组。
var groups = data.OrderBy(d => d.Time).GroupBy(d => d.Period);
var first = groups.First().ToArray();
var remaining = groups.Skip(1).??
答案 0 :(得分:4)
var remaining = groups.Skip(1).SelectMany(g=>g).ToArray();
答案 1 :(得分:1)
使用SelectMany
“展平”集合集合:
var remaining = groups.Skip(1).SelectMany(d => d).ToArray();