有几条数据是这样的

Person      123    456      789

Person      321    654      987

 

想合并成

Person      444     1110   1776

直接一条linq搞定

 

var newQuery = from p in query group p by p.Name into g
                               select new { Name = g.Name, Value = g.Sum(x => x.Value) };

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-01-31
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2022-12-23
  • 2021-10-28
  • 2021-12-20
  • 2022-02-01
  • 2021-08-09
相关资源
相似解决方案