System.Reflection.PseudoCustomAttribute.IsDefined C# (CSharp) Method

IsDefined() static private method

static private IsDefined ( Assembly assembly, Type caType ) : bool
assembly Assembly
caType System.Type
return bool
        internal static bool IsDefined(Assembly assembly, Type caType)
        {
            int count;
            return GetCustomAttributes(assembly, caType, out count).Length > 0;
        }

Same methods

PseudoCustomAttribute::IsDefined ( Module module, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( ParameterInfo parameter, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimeConstructorInfo ctor, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimeEventInfo e, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimeFieldInfo field, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimeMethodInfo method, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimePropertyInfo property, Type caType ) : bool
PseudoCustomAttribute::IsDefined ( RuntimeType type, Type caType ) : bool

Usage Example

 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);
 }
All Usage Examples Of System.Reflection.PseudoCustomAttribute::IsDefined