public static string EnumMetadataDisplay(this Enum value)
{
var name = Enum.GetName(value.GetType(), value);
if (string.IsNullOrEmpty(name))
return value.ToString();
var attribute = value.GetType().GetField(name).GetCustomAttributes(
typeof (DisplayAttribute), false)
.Cast<DisplayAttribute>()
.FirstOrDefault();
if (attribute != null)
return attribute.Name;
return value.ToString();
}