PostSharpAPI ReferencePost­Sharp.​ReflectionReflection­SearchHas­Custom­Attribute
Open sandboxFocus

ReflectionSearch.HasCustomAttribute Method

HasCustomAttribute(Object, Type, Boolean)

Determines whether a declaration has a custom attribute of a given type, including those who have been added indirectly, for instance through MulticastAttribute.

public static bool HasCustomAttribute(object target, Type type, bool inherit = false)
Type Name Description
Object target

Element of code (Type, MethodInfo, ...) whose custom attributes are requested.

Type type

The type of custom attributes.

Boolean inherit

true to consider custom attributes derived from type, false to consider only custom attributes strictly of type type.

Type Description

True if type has a custom attribute of type type, otherwise false.