标签:
将一个dataTABLE转化成linq:
1 DataTable dtChangeDetail = new DataTable(); 2 dtChangeDetail.Columns.Add("IsModi",typeof(Boolean)); //记录是否变动 3 dtChangeDetail.Columns.Add("FromDeptID", typeof(Int32)); 4 dtChangeDetail.Columns.Add("FromPostID", typeof(String)); 5 dtChangeDetail.Columns.Add("FromPostNumBef",typeof(Int32)); 6 dtChangeDetail.Columns.Add("FromPostNumChange", typeof(Int32)); 7 8 var data = from row in dtChangeDetail.AsEnumerable() 9 select new 10 { 11 IsModi = false, 12 FromDeptID = row.Field<Int32>("FromDeptID"), 13 FromPostID = row.Field<string>("FromPostID"), 14 FromPostNumBef = row.Field<Int32>("FromPostNumBef")
};
List a = data.ToList();
标签:
原文地址:http://www.cnblogs.com/enjoyGarden/p/4638222.html