/// <summary>
/// 返回枚举中的desciption
/// </summary>
/// <param name="value">枚举</param>
/// <returns></returns>
public static string GetDescription(
this Enum value)
{
return value.GetType()
.GetMember(value.ToString())
.FirstOrDefault()?
.GetCustomAttribute<DescriptionAttribute>()?
.Description;
}
转载于:https://www.cnblogs.com/siyunianhua/p/10772667.html
相关资源:JAVA上百实例源码以及开源项目