/// <summary> /// 得到制定枚举数的说明 /// </summary> /// <param name="enumValue">枚举数</param> /// <returns>枚举数的说明</returns> public static EnumValueExplanation GetEnumValueExplanation(Enum enumValue) { if (enumValue == null) { throw new ArgumentNullException("enumType 不能为空!"); } Attribute attribute = Reflector.FindAttribute(enumValue, typeof(ExplanationAttribute)); if (attribute != null) { ExplanationAttribute attribute2 = attribute as ExplanationAttribute; return(new EnumValueExplanation(enumValue, attribute2.Name, attribute2.Description, attribute2.Tag)); } return(null); }
/// <summary> /// 构造函数 /// </summary> /// <param name="explanationAttribute">说明信息</param> /// <param name="target">说明的目标</param> public Explanation(ExplanationAttribute explanationAttribute, object target) : this(explanationAttribute.Name, explanationAttribute.Description, explanationAttribute.Tag, target) { }