public static string GetDescription(System.Enum enumItem)
        {
            string result = string.Empty;

            EnumItemDescriptionAttribute attr = GetAttribute(enumItem);

            if (attr != null)
            {
                result = attr.Description;
            }

            return(result);
        }
        private void FillDescriptionAttributeInfo(EnumItemDescriptionAttribute attr)
        {
            if (attr != null)
            {
                this.Description = attr.description;
                this.ShortName   = attr.ShortName;
                this.Category    = attr.Category;

                if (attr.SortId != -1)
                {
                    this.sortId = attr.SortId;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到某个枚举项的描述
        /// </summary>
        /// <param name="enumItem"></param>
        /// <returns></returns>
        public static string ToDescription(this System.Enum enumItem)
        {
            enumItem.NullCheck("enumItem");

            return(EnumItemDescriptionAttribute.GetDescription(enumItem));
        }