| | |
| | | using HStation.RevitDev.RevitDataExport.Enum; |
| | | using HStation.RevitDev.Model.ModelEnum; |
| | | using System; |
| | | using System.ComponentModel; |
| | | using System.Reflection; |
| | |
| | | /// <summary> |
| | | /// 获取枚举的描述信息 |
| | | /// </summary> |
| | | public static string GetDescription(this YWFamilyType em) |
| | | public static string GetDescription(this RevitType em) |
| | | { |
| | | Type type = em.GetType(); |
| | | FieldInfo fd = type.GetField(em.ToString()); |
| | |
| | | } |
| | | 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;
|
| | | } |
| | | } |
| | | } |
| | | |