Beispiel #1
0
 public static IEnumerable <T> AllAttributes <T>(
     this MemberInfo provider)
     where T : Attribute
 {
     return(provider.AllAttributes(typeof(T)).Cast <T>());
 }
Beispiel #2
0
 public static bool HasAttribute <T>(this MemberInfo provider)
     where T : Attribute
 {
     return(provider.AllAttributes(typeof(T)).Any());
 }
Beispiel #3
0
 public static T TryGetAttribute <T>(this MemberInfo provider)
     where T : Attribute
 {
     return(provider.AllAttributes <T>().OnlyOrDefault());
 }
Beispiel #4
0
 public static bool HasAttribute(
     this MemberInfo provider, params Type[] attributeTypes)
 {
     return(provider.AllAttributes(attributeTypes).Any());
 }
Beispiel #5
0
 public static T GetAttribute <T>(this MemberInfo provider)
     where T : Attribute
 {
     return(provider.AllAttributes <T>().Single());
 }