/// <summary> /// 获取Enum 枚举类型的注释 /// </summary> /// <param name="obj"></param> /// <returns></returns> public static string GetDescription(this Enum obj) { return(EnumDictionary.GetOrAdd(obj, (o) => { var type = o.GetType(); FieldInfo field = type.GetField(Enum.GetName(type, o)); DescriptionAttribute descAttr = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute; if (descAttr == null) { return string.Empty; } return descAttr.Description; })); }