public static DataTable ToDataTableTow(IList list) { DataTable result = new DataTable(); ) { PropertyInfo[] propertys = list[].GetType().GetProperties(); foreach (PropertyInfo pi in propertys) { result.Columns.Add(pi.Name, pi.PropertyType); } ; i < l…
1 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Collections; using System.Web.Script.Serialization; /// <summary> ///JsonHelper 的摘要说明 /// </summary> public class JsonHelper…
List转DataTable: public static DataTable ToDataTable<T>(IEnumerable<T> collection) { var props = typeof(T).GetProperties(); var dt = new DataTable(); dt.Columns.AddRange(props.Select(p => new DataColumn(p.Name, p.PropertyType)).ToArray()); )…