public static object[] AllAttributes(this MemberInfo memberInfo, Type attrType) { PropertyInfo propertyInfo = memberInfo as PropertyInfo; if (propertyInfo != (PropertyInfo)null) { return(PlatformExtensions.AllAttributes(propertyInfo, attrType)); } return(memberInfo.GetCustomAttributes(attrType, true)); }
public static TAttr[] AllAttributes <TAttr>(this PropertyInfo pi) { return(PlatformExtensions.AllAttributes(pi, typeof(TAttr)).Cast <TAttr>().ToArray <TAttr>()); }
public static TAttr[] AllAttributes <TAttr>(this FieldInfo fi) { return(PlatformExtensions.AllAttributes(fi, typeof(TAttr)).Cast <TAttr>().ToArray <TAttr>()); }
public static bool HasAttributeNamed(this FieldInfo fi, string name) { string normalizedAttr = name.Replace("Attribute", "").ToLower(); return(((IEnumerable <object>)PlatformExtensions.AllAttributes(fi)).Any <object>((Func <object, bool>)(x => x.GetType().Name.Replace("Attribute", "").ToLower() == normalizedAttr))); }
public static bool HasAttribute <T>(this FieldInfo fi) { return(((IEnumerable <object>)PlatformExtensions.AllAttributes(fi)).Any <object>((Func <object, bool>)(x => x.GetType() == typeof(T)))); }