C# 计算
时间:2021-04-26 13:48:48
收藏:0
阅读:0
1.Datatable、DataRow[]、List 、List子集合、 某列求和
DataTable dt = new DataTable(); var sum1 = dt.Compute("SUM(Volume)", ""); DataRow[] drList = dt.Select("Name=‘AAA‘"); var sum2 = drList.Sum(x => x.Field<decimal>("Volume")); var tJlbList = new List<TJlb_Mod>(); var sum3 = tJlbList.Sum(o => o.FBcfs); var sum4 = tJlbList.SelectMany(x => x.TJlb_P_Items).Sum(o => o.FBcfs);
评论(0)