反射_获取字段的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;

posted @ 2014-12-19 10:48  Coding_Yong  阅读(479)  评论(0编辑  收藏  举报