JsonConverterAttribute Třída

Definice

Při umístění na vlastnost nebo typ určuje typ převaděče, který se má použít.

public ref class JsonConverterAttribute : System::Text::Json::Serialization::JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)]
public class JsonConverterAttribute : System.Text.Json.Serialization.JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)]
public class JsonConverterAttribute : System.Text.Json.Serialization.JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)]
public class JsonConverterAttribute : System.Text.Json.Serialization.JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)>]
type JsonConverterAttribute = class
    inherit JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)>]
type JsonConverterAttribute = class
    inherit JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)>]
type JsonConverterAttribute = class
    inherit JsonAttribute
Public Class JsonConverterAttribute
Inherits JsonAttribute
Dědičnost
JsonConverterAttribute
Atributy

Poznámky

Zadaný typ převaděče musí být odvozen od JsonConverter.

Při umístění na vlastnost se zadaný převaděč vždy použije.

Při umístění na typ se zadaný převaděč použije, pokud není do kolekce přidán JsonSerializerOptions.Converters kompatibilní převaděč nebo existuje jiná JsonConverterAttribute vlastnost stejného typu.

Další informace naleznete v tématu Jak psát vlastní převaděče pro serializaci JSON.

Konstruktory

Name Description
JsonConverterAttribute()

Inicializuje novou instanci .JsonConverterAttribute

JsonConverterAttribute(Type)

Inicializuje novou instanci JsonConverterAttribute se zadaným typem převaděče.

Vlastnosti

Name Description
ConverterType

Získá typ JsonConverterAttribute, nebo null pokud byl vytvořen bez typu.

TypeId

Při implementaci v odvozené třídě získá jedinečný identifikátor pro tento Attribute.

(Zděděno od Attribute)

Metody

Name Description
CreateConverter(Type)

Při přepsání v odvozené třídě a ConverterType je null, umožňuje odvozené třídy vytvořit za JsonConverter účelem předání dalšího stavu.

Equals(Object)

Vrátí hodnotu, která určuje, zda je tato instance rovna zadanému objektu.

(Zděděno od Attribute)
GetHashCode()

Vrátí kód hash pro tuto instanci.

(Zděděno od Attribute)
GetType()

Získá Type aktuální instance.

(Zděděno od Object)
IsDefaultAttribute()

Při přepsání v odvozené třídě určuje, zda hodnota této instance je výchozí hodnotou pro odvozenou třídu.

(Zděděno od Attribute)
Match(Object)

Při přepsání v odvozené třídě vrátí hodnotu, která určuje, zda se tato instance rovná zadanému objektu.

(Zděděno od Attribute)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Object.

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro