// This method will look in any stored attributes in the link context as well as the provider itself. public static bool HasCustomAttribute(this ICustomAttributeProvider provider, DerivedLinkContext context, string @namespace, string name) { if (provider?.HasCustomAttribute(@namespace, name) == true) { return(true); } return(context?.GetCustomAttributes(provider, @namespace, name)?.Count > 0); }
static BindingImplOptions?GetBindingImplAttribute(ICustomAttributeProvider provider, DerivedLinkContext context) { if (provider != null && provider.HasCustomAttributes) { var rv = GetBindingImplAttribute(provider, provider.CustomAttributes); if (rv != null) { return(rv); } } return(GetBindingImplAttribute(provider, context?.GetCustomAttributes(provider, Namespaces.ObjCRuntime, "BindingImplAttribute"))); }