PostSharp6.3/API Reference/Post­Sharp.​Reflection Namespace/Reflection­Search Class/Reflection­Search Methods/Reflection­Search.​Get­Custom­Attributes­Of­Type Method/Reflection­Search.​Get­Custom­Attributes­Of­Type Method (Type, Reflection­Search­Options)

ReflectionSearch.GetCustomAttributesOfType Method (Type, ReflectionSearchOptions)

Gets all custom attributes of a given type in the assembly being currently processed and specifies additional options.

Namespace:  PostSharp.Reflection
Assembly:  PostSharp (in PostSharp.dll) Version: 6.3.9.0 (6.3.9.0)
Syntax
C#
public static CustomAttributeInstance[] GetCustomAttributesOfType(
	Type customAttributeType,
	ReflectionSearchOptions options
)

Parameters

customAttributeType
Type: System.Type
Type of the custom attribute.
options
Type: PostSharp.Reflection.ReflectionSearchOptions
Any combination of options IncludeDerivedTypes and [!:ReflectionSearchOptions.UseReflectionWrappers].

Return Value

Type: CustomAttributeInstance[]
The set of all custom attributes of type customAttributeType (or any type derived from customAttributeType, if the option IncludeDerivedTypes is true) defined in the assembly being currently processed.
Remarks

Note Note
This method returns custom attributes from the internal annotation repository of PostSharp. This repository contains more than only custom attributes added in source code. For instance, if you use MulticastAttribute to add a custom attribute to several elements of code in a single line of code, this method will return one custom attribute instance for every target of the MulticastAttribute .

Note Note
This feature is available only at build time.

See Also