C# GroupBy的使用
2021-03-17 17:25
标签:uip skill eva ant details groupby hhhh query tail 输出结果 转自:https://blog.csdn.net/hhhhhhenrik/article/details/81980594?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task C# GroupBy的使用 标签:uip skill eva ant details groupby hhhh query tail 原文地址:https://www.cnblogs.com/firstcsharp/p/12384941.htmlvar skill = query.GroupBy(i=>i.SkillTypeId)
.Select(i => new
{
skillType=i.key,
skill=i.Select(s=>new{
i.Id,
i.Level,
i.IsEquiped,
})
{
"skillType":“刀”
"skill": [
{
"Id": 35,
"Level": 1,
"IsEquiped": true,
},
{
"Id": 36,
"Level": 1,
"IsEquiped": true,
},
]
"skillType":"剑"
"skill": [
{
"Id": 35,
"Level": 1,
"IsEquiped": true,
},
{
"Id": 36,
"Level": 1,
"IsEquiped": true,
},
]
}