反射标签存档

获得当前程序位置

string Location = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) 即可获得当前程序的位置.

泛型与DataTable的互相转化

///DataTable到范型转换 /// <summary> /// 适合于实体类和DataTable对应的情况 /// </summary> //将泛型类转换成DataTable    public static DataTable ToDataTable<T>(List<T> entitys)     {        DataTable dtResult = new DataTable();         if (entitys == null || entitys.Count < 1)         {             throw new Exception("需转换的集合为空");         }         Type entityType = entitys[0].GetType();         List<PropertyInfo> propertyInfoList = entityType.GetProperties().ToList<PropertyInfo>;...