IsDefined() static private method

static private IsDefined ( Assembly assembly, Type caType ) : bool
assembly Assembly
caType System.Type
return bool
 internal static bool IsDefined(RuntimeType type, RuntimeType caType, bool inherit)
 {
     if (type.GetElementType() != null)
     {
         return(false);
     }
     if (PseudoCustomAttribute.IsDefined(type, caType))
     {
         return(true);
     }
     if (CustomAttribute.IsCustomAttributeDefined(type.GetRuntimeModule(), type.MetadataToken, caType))
     {
         return(true);
     }
     if (!inherit)
     {
         return(false);
     }
     type = (type.BaseType as RuntimeType);
     while (type != null)
     {
         if (CustomAttribute.IsCustomAttributeDefined(type.GetRuntimeModule(), type.MetadataToken, caType, 0, inherit))
         {
             return(true);
         }
         type = (type.BaseType as RuntimeType);
     }
     return(false);
 }
 internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
 {
     if (PseudoCustomAttribute.IsDefined(method, caType))
     {
         return(true);
     }
     if (CustomAttribute.IsCustomAttributeDefined(method.GetRuntimeModule(), method.MetadataToken, caType))
     {
         return(true);
     }
     if (!inherit)
     {
         return(false);
     }
     method = method.GetParentDefinition();
     while (method != null)
     {
         if (CustomAttribute.IsCustomAttributeDefined(method.GetRuntimeModule(), method.MetadataToken, caType, 0, inherit))
         {
             return(true);
         }
         method = method.GetParentDefinition();
     }
     return(false);
 }
Beispiel #3
0
 internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(field, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(field.GetRuntimeModule(), field.MetadataToken, caType));
 }
Beispiel #4
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(e, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(e.GetRuntimeModule(), e.MetadataToken, caType));
 }
Beispiel #5
0
 internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(property, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(property.GetRuntimeModule(), property.MetadataToken, caType));
 }
Beispiel #6
0
 internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(ctor, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(ctor.GetRuntimeModule(), ctor.MetadataToken, caType));
 }
Beispiel #7
0
 internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(assembly, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(assembly.ManifestModule as RuntimeModule, RuntimeAssembly.GetToken(assembly.GetNativeHandle()), caType));
 }
Beispiel #8
0
 internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
 {
     if (PseudoCustomAttribute.IsDefined(parameter, caType))
     {
         return(true);
     }
     return(CustomAttribute.IsCustomAttributeDefined(parameter.GetRuntimeModule(), parameter.MetadataToken, caType));
 }
Beispiel #9
0
        internal static bool IsDefined(RuntimeModule module, RuntimeType caType)
        {
            if (PseudoCustomAttribute.IsDefined(module, caType))
            {
                return(true);
            }
            RuntimeModule decoratedModule     = module;
            int           metadataToken       = decoratedModule.MetadataToken;
            RuntimeType   attributeFilterType = caType;

            return(CustomAttribute.IsCustomAttributeDefined(decoratedModule, metadataToken, attributeFilterType));
        }
Beispiel #10
0
 internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(property, caType) || IsCustomAttributeDefined(property.Module, property.MetadataToken, caType));
 }
 internal static bool IsDefined(RuntimeModule module, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(module, caType) || CustomAttribute.IsCustomAttributeDefined(module, module.MetadataToken, caType));
 }
Beispiel #12
0
 internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(field, caType) || IsCustomAttributeDefined(field.Module, field.MetadataToken, caType));
 }
Beispiel #13
0
 internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(e, caType) || IsCustomAttributeDefined(e.Module, e.MetadataToken, caType));
 }
Beispiel #14
0
 internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(ctor, caType) || IsCustomAttributeDefined(ctor.Module, ctor.MetadataToken, caType));
 }
Beispiel #15
0
 internal static bool IsDefined(ParameterInfo parameter, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(parameter, caType) || IsCustomAttributeDefined(parameter.Member.Module, parameter.MetadataToken, caType));
 }
Beispiel #16
0
 internal static bool IsDefined(Assembly assembly, RuntimeType caType)
 {
     return(PseudoCustomAttribute.IsDefined(assembly, caType) || IsCustomAttributeDefined(assembly.ManifestModule, assembly.AssemblyHandle.GetToken(), caType));
 }