Example #1
0
        public static string ToAbbreviation(this Enum enumItem)
        {
            EnumStringAttribute attribute = GetAttribute <EnumStringAttribute>(enumItem);

            return(attribute != null ? attribute.Abbreviation : string.Empty);
        }
Example #2
0
        public static string ToDescription(this Enum enumItem)
        {
            EnumStringAttribute attribute = GetAttribute <EnumStringAttribute>(enumItem);

            return(attribute != null && !string.IsNullOrEmpty(attribute.Description) ? attribute.Description : enumItem.ToString());
        }