Esempio n. 1
0
        /// <summary>
        /// If enum implements the InfoAttribute then returns this tostring
        /// otherwise returns enum as string.
        /// </summary>
        public static string ToInfoString(this Enum value)
        {
            if (value == null)
            {
                throw new NullReferenceException(nameof(value));
            }

            InfoAttribute?info = EnumTools.GetEnumInfo(value, value.GetType());

            if (info != null)
            {
                return(info.ToString());
            }

            return(value.ToString());
        }