c# datatable 分组

 DataTable dt = new DataTable();
 IEnumerable<IGrouping<string, DataRow>> result = dt.Rows.Cast<DataRow>().GroupBy<DataRow, string>(dr => dr["行政代码"].ToString().Substring(0, 2));//按行政区代码前两位分组

猜你喜欢

转载自www.cnblogs.com/SeNaiTes/p/10615851.html