示例#1
0
        public static string GetDisplayName([NotNull] this Enum value)
        {
            var descriptions = value.GetAttributeValues <DisplayNameAttribute, string>(a => a.DisplayName);

            return(descriptions.Length > 0
                ? string.Join(Environment.NewLine, descriptions)
                : string.Empty);
        }
示例#2
0
 public static IEnumerable <string> GetDisplayNames([NotNull] this Enum value) => value.GetAttributeValues <DisplayNameAttribute, string>(a => a.DisplayName);
示例#3
0
 public static IEnumerable <string> GetDescriptions([NotNull] this Enum value) => value.GetAttributeValues <DescriptionAttribute, string>(a => a.Description);