您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

20 行
472 B

  1. using System;
  2. using System.Reflection;
  3. using SUISS.Core.Utilities;
  4. public static class EnumUtilities
  5. {
  6. public static T GetEnumProp<T>(Enum value) where T : Attribute
  7. {
  8. T result = (T)((object)null);
  9. Type type = value.GetType();
  10. FieldInfo field = type.GetCompatibleTypeInfo().GetField(value.ToString());
  11. T[] array = field.GetCustomAttributes(typeof(T), false) as T[];
  12. if (array.Length > 0)
  13. {
  14. result = array[0];
  15. }
  16. return result;
  17. }
  18. }