C# GroupBy的使用

2021-03-17 17:25

阅读:699

标签:uip   skill   eva   ant   details   groupby   hhhh   query   tail   

var 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,
                  
                },
     ]
}

转自: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.html


评论


亲,登录后才可以留言!