using System;
namespace JiaZhiQuan.Common
{
///
/// 枚举拓展
///
public static class EnumExtention
{
///
/// 获取枚举描述
///
///
///
public static string GetDescription(this System.Enum val)
{
var field = val.GetType().GetField(val.ToString());
var customAttribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute));
return customAttribute == null ? val.ToString() : ((DescriptionAttribute) customAttribute).Description;
}
}
}