|
- using System;
- using System.Reflection;
- using SUISS.Core.Utilities;
-
- public static class EnumUtilities
- {
- public static T GetEnumProp<T>(Enum value) where T : Attribute
- {
- T result = (T)((object)null);
- Type type = value.GetType();
- FieldInfo field = type.GetCompatibleTypeInfo().GetField(value.ToString());
- T[] array = field.GetCustomAttributes(typeof(T), false) as T[];
- if (array.Length > 0)
- {
- result = array[0];
- }
- return result;
- }
- }
|