PostSharp 4.3 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Reflection Namespace / Reflection­Search Class / Reflection­Search Methods / Reflection­Search.​Has­Custom­Attribute Method
ReflectionSearch.HasCustomAttribute Method
Determines whether a declaration has a custom attribute of a given type, including those who have been added indirectly, for instance through MulticastAttribute.

Namespace: PostSharp.Reflection
Assembly: PostSharp (in PostSharp.dll) Version: 4.3.48.0 (4.3.48.0)
Syntax
C#
public static bool HasCustomAttribute(
	Object target,
	Type type,
	bool inherit = false
)

Parameters

target
Type: System.Object
Element of code (Type, MethodInfo, ...) whose custom attributes are requested.
type
Type: System.Type
The type of custom attributes.
inherit (Optional)
Type: System.Boolean
true to consider custom attributes derived from type, false to consider only custom attributes strictly of type type.

Return Value

Type: Boolean
True if type has a custom attribute of type type, otherwise false.
See Also