Utility.cs 342 B

12345678910111213
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. namespace NTERA.Engine
  4. {
  5. public static class Utility
  6. {
  7. public static IEnumerable<TAttribute> GetEnumAttributes<TEnum, TAttribute>(TEnum enumValue)
  8. {
  9. return typeof(TEnum).GetField(enumValue.ToString()).GetCustomAttributes(typeof(TAttribute), false).Cast<TAttribute>();
  10. }
  11. }
  12. }