Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joshi-kumar/9d0c98f6295c97007614b68e6fea7fa8 to your computer and use it in GitHub Desktop.
Save joshi-kumar/9d0c98f6295c97007614b68e6fea7fa8 to your computer and use it in GitHub Desktop.
Dispaly ENUM class property name (Display attribute value)
public string GetDisplayName(Enum enumValue)
{
return enumValue.GetType().GetMember(enumValue.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()
.Name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment