JsonExtensionDataAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
IDictionary<TKey,TValue>型のプロパティに配置すると、一致するメンバーを持たないプロパティは、逆シリアル化中にそのディクショナリに追加され、シリアル化中に書き込まれます。
public ref class JsonExtensionDataAttribute sealed : System::Text::Json::Serialization::JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class JsonExtensionDataAttribute : System.Text.Json.Serialization.JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class JsonExtensionDataAttribute : System.Text.Json.Serialization.JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)>]
type JsonExtensionDataAttribute = class
inherit JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false)>]
type JsonExtensionDataAttribute = class
inherit JsonAttribute
Public NotInheritable Class JsonExtensionDataAttribute
Inherits JsonAttribute
- 継承
- 属性
注釈
ディクショナリの TKey 値は Stringする必要があり、 TValue は JsonElement または Objectする必要があります。
逆シリアル化中、 Objectを使用する場合、"null" JSON 値は null オブジェクト参照として扱われ、 JsonElementを使用する場合、"null" は jsonElement として扱われ、 ValueKind は JsonValueKind.Null に設定されます。
シリアル化中、拡張データ プロパティの名前は JSON に含まれません。拡張データに含まれるデータは、JSON オブジェクトのプロパティとしてシリアル化されます。
この拡張データ属性を持つ型に複数のプロパティがある場合、またはプロパティ自体が正しい IDictionary<TKey,TValue> 型でない場合は、その型の最初のシリアル化または逆シリアル化中に InvalidOperationException がスローされます。
詳細については、「 System.Text.Json を使用してオーバーフロー JSON を処理する方法」を参照してください。
コンストラクター
| 名前 | 説明 |
|---|---|
| JsonExtensionDataAttribute() |
JsonExtensionDataAttribute クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| TypeId |
派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。 (継承元 Attribute) |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| GetHashCode() |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IsDefaultAttribute() |
派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
| Match(Object) |
派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |