/// <summary> /// 通过字符串获取枚举成员实例 /// </summary> /// <typeparam name="T">枚举名,比如Enum1</typeparam> /// <param name="member">枚举成员的常量名或常量值, /// 范例:Enum1枚举有两个成员A=0,B=1,则传入"A"或"0"获取 Enum1.A 枚举类型</param> public static T GetInstance <T>(string member) { return(ConvertHelper.ConvertTo <T>(Enum.Parse(typeof(T), member, true))); }