我有以下内容:
List<Something> somethings = new List<Something>()
{
new Something(){ Connection = "Bob" },
new Something(){ Connection = "Bob" },
new Something(){ Connection = "Peter" },
}
我想最终得到以下结论:
List<List<<Something>> groupedSomethings = new List<List<<Something>>()
new List<Something>()
{
new Something(){ Connection = "Bob" },
new Something(){ Connection = "Bob" }
}
new List<Something>()
{
new Something(){ Connection = "Peter" },
}
}
我无法正确获得Linq声明。
我想它看起来像这样:
List<List<<Something>> groupedSomethings = somethings
.GroupBy(x => x.Connection)
.SelectMany(somethings => new List<Something>());
你会怎么做?
答案 0 :(得分:6)
您可以使用$
.get("/getProces")
.then((res) => res.error ? Promise.reject(res) : Promise.resolve(res))
.then((data) => {
for (var i = 0; i < data.message.length; i++) {
var obj = data.message[i]
console.log(obj.processen_id)
}
})
,然后从该组中获取值:
GroupBy