反射_获取字段的Description信息

var memInfo = enumType.GetType().GetMember(enumType.ToString());

var attributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false).Cast<DescriptionAttribute>();
if (attributes.Any())
return attributes.First().Description;
return string.Empty;

原文地址:https://www.cnblogs.com/sunzhenyong/p/4173403.html