标签:lis wro foreach ati tor oda this tab eof
public static DataTable CopyToDataTable<T>(this IEnumerable<T> array) { var ret = new DataTable(); foreach (PropertyDescriptor dp in TypeDescriptor.GetProperties(typeof(T))) ret.Columns.Add(dp.Name); foreach (T item in array) { var Row = ret.NewRow(); foreach (PropertyDescriptor dp in TypeDescriptor.GetProperties(typeof(T))) Row[dp.Name] = dp.GetValue(item); ret.Rows.Add(Row); } return ret; }
以上
标签:lis wro foreach ati tor oda this tab eof
原文地址:http://www.cnblogs.com/jiangyou-lz/p/6252618.html