PostSharp//API Reference/Post­Sharp.​Reflection/Reflection­Search/Get­Custom­Attributes­Of­Type
Open sandboxFocus

Method GetCustomAttributesOfType

GetCustomAttributesOfType(Type)

Gets all custom attributes of a given type in the assembly being currently processed.

Declaration
public static CustomAttributeInstance[] GetCustomAttributesOfType(Type customAttributeType)
Parameters
Type Name Description
Type customAttributeType

Type of the custom attribute.

Returns
Type Description
CustomAttributeInstance[]

The set of all custom attributes of type customAttributeType defined in the assembly being currently processed.

GetCustomAttributesOfType(Type, ReflectionSearchOptions)

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

Declaration
public static CustomAttributeInstance[] GetCustomAttributesOfType(Type customAttributeType, ReflectionSearchOptions options)
Parameters
Type Name Description
Type customAttributeType

Type of the custom attribute.

ReflectionSearchOptions options

Either IncludeDerivedTypes or None.

Returns
Type Description
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.