| | |
| | | } |
| | | return des; |
| | | } |
| | | |
| | | public static string GetDescriptioin(this Enum info)
|
| | | {
|
| | | Type enumType = info.GetType();
|
| | | MemberInfo[] memberInfo = enumType.GetMembers();
|
| | | foreach (MemberInfo member in memberInfo)
|
| | | {
|
| | | string enumName = member.Name;
|
| | | if (enumName == info.ToString())
|
| | | {
|
| | | var attrs = member.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
| | | if (attrs.Length == 0) { return string.Empty; }
|
| | |
|
| | | DescriptionAttribute attr = attrs[0] as DescriptionAttribute;
|
| | | return attr.Description;
|
| | | }
|
| | | }
|
| | | return string.Empty;
|
| | | } |
| | | } |
| | | } |
| | | |