Share via


AIJsonSchemaCreateContext.GetCustomAttribute<TAttribute> Method

Definition

Retrieves a custom attribute of a specified type that is applied to the specified schema node context.

public TAttribute? GetCustomAttribute<TAttribute> (bool inherit = false) where TAttribute : Attribute;
member this.GetCustomAttribute : bool -> 'Attribute (requires 'Attribute :> Attribute)
Public Function GetCustomAttribute(Of TAttribute As Attribute) (Optional inherit As Boolean = false) As TAttribute

Type Parameters

TAttribute

The type of attribute to search for.

Parameters

inherit
Boolean

If true, specifies to also search the ancestors of the context members for custom attributes.

Returns

TAttribute

The first occurrence of TAttribute if found, or null otherwise.

Remarks

This helper method resolves attributes from context locations in the following order:

Applies to