document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public static T GetAttributeOfType<T> (this Enum enumVal) where T:System.Attribute
  2. {
  3. var type = enumVal.GetType ();
  4. var memInfo = type.GetMember (enumVal.ToString ());
  5. var attributes = memInfo [0].GetCustomAttributes (typeof(T), false);
  6. return (attributes.Length > 0) ? (T)attributes [0] : null;
  7. }
');