using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace HRD.WebApi.Extensions
{
public static class EnumExtensions
{
///
/// Get the Description from the DescriptionAttribute.
///
///
///
public static string GetDescription(this Enum enumValue)
{
return enumValue.GetType()
.GetMember(enumValue.ToString())
.First()
.GetCustomAttribute()?
.Description ?? string.Empty;
}
}
}