AIJsonSchemaCreateContext.GetCustomAttribute<TAttribute> Metod

Definition

Hämtar ett anpassat attribut av en angiven typ som tillämpas på den angivna schemanodkontexten.

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

Typparametrar

TAttribute

Typ av attribut att söka efter.

Parametrar

inherit
Boolean

Om trueanger anger du att även söka efter anpassade attribut i kontextmedlemmarnas överordnade objekt.

Returer

TAttribute

Den första förekomsten av TAttribute om den hittas, eller null på annat sätt.

Kommentarer

Den här hjälpmetoden löser attribut från kontextplatser i följande ordning:

  1. Attribut som anges för kontextens egenskap, om de anges.
  2. Attribut som anges på konstruktorparametern för kontexten, om det anges.
  3. Attribut som anges för typen av kontext.

Gäller för