获取枚举Description的Name
/// <summary> /// 获取枚举Description的Name /// </summary> /// <param name="enumName">枚举</param> /// <returns></returns> public static string GetDescription(Enum enumName) { var name = enumName.ToString(); var type = enumName.GetType(); var fieldInfo = type.GetField(name); var arrDesc = (DescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false); return arrDesc[0].Description; }