首页 > 其他分享 >GroupBy中多列合并一列方法

GroupBy中多列合并一列方法

时间:2022-08-31 10:57:21浏览次数:65  
标签:ToArray list 一列 Key new 多列 GroupBy Select


  1. var query=list.GroupBy(t=>new{t....分组字段})
      .Select(g=>

new {FROM=g.Key.From,TO=g.Key.To,NUM=g.Count(),Time=g.Key.Time,Body=string.Join(",",g.Select(s=>s.Body).ToArray())})

 

2var list=list.GroupBy(t=>new{ ...分组字段}).Select(p =>new 类 {属性=p.key.值,属性=string.Join(",",p.Select(s=>s.值).ToArray())}

标签:ToArray,list,一列,Key,new,多列,GroupBy,Select
From: https://www.cnblogs.com/NewLift/p/16642222.html

相关文章