DataTable dt = new DataTable(); IEnumerable<IGrouping<string, DataRow>> result = dt.Rows.Cast<DataRow>().GroupBy<DataRow, string>(dr => dr["行政代码"].ToString().Substring(0, 2));//按行政区代码前两位分组
DataTable dt = new DataTable(); IEnumerable<IGrouping<string, DataRow>> result = dt.Rows.Cast<DataRow>().GroupBy<DataRow, string>(dr => dr["行政代码"].ToString().Substring(0, 2));//按行政区代码前两位分组
转载于:https://www.cnblogs.com/SeNaiTes/p/10615851.html