using System; using System.Linq; using System.Reflection; namespace Common { [AttributeUsage(AttributeTargets.Field)] public sealed class FieldDisplayNameAttribute : System.ComponentModel.DisplayNameAttribute { public FieldDisplayNameAttribute(string name) : base(name) { } } public static class Extensions { public static string GetDisplayName(this Enum enumValue) { return enumValue.GetType() .GetMember(enumValue.ToString()) .First() .GetCustomAttribute()? .DisplayName; } } }