zoukankan      html  css  js  c++  java
  • linq 分组求和

    static void Main()

            {
                DataTable dt = new DataTable();
                dt.Columns.Add("c1"typeof(int));
                dt.Columns.Add("c2"typeof(string));
                dt.Columns.Add("c3"typeof(int));
      
      
                dt.Rows.Add(1, "技术部", 130);
                dt.Rows.Add(2, "产品部", 200);
      
                dt.Rows.Add(3, "市场部", 130);
                dt.Rows.Add(3, "市场部", 30);
      
                var query = from d in dt.AsEnumerable()
                            group d by d.Field<string>("c2") into g
                            select new
                            {
                                c2 = g.Key,
                                c3 = g.Sum(t => t.Field<int>("c3"))
                            };
                query.ToList().ForEach(q => Console.WriteLine("{0},{1}", q.c2, q.c3));
            }
  • 相关阅读:
    Hadoop是什么
    Hadoop的安装模式
    hadoop和云计算的关系
    no server suitable for synchronization found的解决办法
    hadoop的产生背景、发展历程
    Hadoop生态系统
    学习路线
    日历+时钟
    新世界(未完善)
    简单的点击切换图
  • 原文地址:https://www.cnblogs.com/bingguang/p/3275767.html
Copyright © 2011-2022 走看看