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