IEnumerable<IGrouping<string, DataRow>> result = dt.Rows.Cast<DataRow>().GroupBy<DataRow, string>(dr => dr["FORMSERIALNUMBER"].ToString());//C# 对DataTable中的某列分组,result中的Key是分组后的值 foreach (IGrouping<string, DataRow> ig in result) { var tmpEmailString = ""; foreach (DataRow dr in ig) { string tmpstr = dr[0].ToString() ; } }
标签:某列,C#,分组,result,dr,DataTable From: https://www.cnblogs.com/ydc2023/p/16996132.html