public static string GetDisplayName(this Enum enumValue)
{
return enumValue.GetType()
.GetMember(enumValue.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()
.GetName(); // GetName (vs. Name) ensures that the localized string will be returned if using the ResourceType attribute property.
}