AIJsonSchemaCreateContext.GetCustomAttribute<TAttribute> メソッド

定義

指定したスキーマ ノード コンテキストに適用される、指定した型のカスタム属性を取得します。

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

型パラメーター

TAttribute

検索する属性の種類。

パラメーター

inherit
Boolean

true場合は、コンテキスト メンバーの先祖も検索してカスタム属性を検索するように指定します。

返品

TAttribute

見つかった場合は TAttribute の最初の出現、それ以外の場合は null

注釈

このヘルパー メソッドは、コンテキストの場所から次の順序で属性を解決します。

  1. コンテキストのプロパティで指定された属性 (指定されている場合)。
  2. コンテキストのコンストラクター パラメーターで指定された属性 (指定されている場合)。
  3. コンテキストの型で指定された属性。

適用対象