GetCustomAttributesOnTarget(object)
Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.
Declaration
public static CustomAttributeInstance[] GetCustomAttributesOnTarget(object target)Parameters
| Type | Name | Description |
|---|---|---|
| object | target | Element of code (Type, MethodInfo, ...) whose custom attributes are requested. |
Returns
| Type | Description |
|---|---|
| CustomAttributeInstance[] | The set of all custom attributes added, directly or indirectly, to |
Remarks
<p>
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
This feature is available only at build time.
GetCustomAttributesOnTarget(object, ReflectionSearchOptions)
Gets all custom attributes on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute.
Declaration
public static CustomAttributeInstance[] GetCustomAttributesOnTarget(object target, ReflectionSearchOptions options)Parameters
| Type | Name | Description |
|---|---|---|
| object | target | Element of code (Type, MethodInfo, ...) whose custom attributes are requested. |
| ReflectionSearchOptions | options | This parameter has no effect and is kept only for backwards compatibility. |
Returns
| Type | Description |
|---|---|
| CustomAttributeInstance[] | The set of all custom attributes added, directly or indirectly, to |
Remarks
<p>
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
This feature is available only at build time.
GetCustomAttributesOnTarget<T>(object, ReflectionSearchOptions)
Gets all custom attributes of a given type on a given element of code, including those who have been added indirectly, for instance through MulticastAttribute and specifies additional options.
Declaration
public static IList<T> GetCustomAttributesOnTarget<T>(object target, ReflectionSearchOptions options = ReflectionSearchOptions.IncludeDerivedTypes) where T : AttributeParameters
| Type | Name | Description |
|---|---|---|
| object | target | Element of code (Type, MethodInfo, ...) whose custom attributes are requested. |
| ReflectionSearchOptions | options |
Returns
| Type | Description |
|---|---|
| IList<T> | The set of all custom attributes added, directly or indirectly, to |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the custom attribute. |
Remarks
<p>
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
This feature is available only at build time.