Lambda表达式

导航

Lambda GroupBy Sum

1 DataTable dt = new DataTable();
2 dt.AsEnumerable().GroupBy(r => r["ShopName"])
3                         .Select(group => new { ShopName = group.Key, SumCount = group.Sum(item => Convert.ToInt32(item["SellCount"])) })

重点就是group.Sum(item => Convert.ToInt32(item["SellCount"]))这一句

posted on 2017-01-03 16:48  Lambda表达式  阅读(4167)  评论(0编辑  收藏  举报