JsonConverterAttribute Třída
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
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.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)]
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.Property | System.AttributeTargets.Struct, AllowMultiple=false)>]
type JsonConverterAttribute = class
inherit 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.Property | System.AttributeTargets.Struct, AllowMultiple=false)>]
type JsonConverterAttribute = class
inherit JsonAttribute
Public Class JsonConverterAttribute
Inherits JsonAttribute
- Dědičnost
- Atributy
Poznámky
Zadaný typ převaděče musí být odvozen z JsonConverter.
Při umístění na vlastnost se vždy použije zadaný převaděč.
Při umístění na typ bude zadaný převaděč použit, pokud není do JsonSerializerOptions.Converters kolekce přidán kompatibilní převaděč nebo pokud není ve vlastnosti stejného typu jiný JsonConverterAttribute .
Další informace najdete v tématu Jak psát vlastní převaděče pro serializaci JSON.
Konstruktory
JsonConverterAttribute() |
Inicializuje novou instanci .JsonConverterAttribute |
JsonConverterAttribute(Type) |
Inicializuje novou instanci JsonConverterAttribute se zadaným typem převaděče. |
Vlastnosti
ConverterType |
Získá typ JsonConverterAttribute, nebo |
TypeId |
Při implementaci v odvozené třídě získá jedinečný identifikátor pro tuto Attributetřídu . (Zděděno od Attribute) |
Metody
CreateConverter(Type) |
Při přepsání v odvozené třídě a ConverterType je |
Equals(Object) |
Vrací hodnotu, která určuje, zda je tato instance rovna zadanému objektu. (Zděděno od Attribute) |
GetHashCode() |
Vrátí hodnotu hash pro tuto instanci. (Zděděno od Attribute) |
GetType() |
Type Získá z aktuální instance. (Zděděno od Object) |
IsDefaultAttribute() |
Při přepsání v odvozené třídě označuje, zda je hodnota této instance 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á označuje, zda se tato instance rovná zadanému objektu. (Zděděno od Attribute) |
MemberwiseClone() |
Vytvoří mělkou kopii aktuálního Objectsouboru . (Zděděno od Object) |
ToString() |
Vrátí řetězec, který představuje aktuální objekt. (Zděděno od Object) |
Platí pro
Váš názor
https://aka.ms/ContentUserFeedback.
Připravujeme: V průběhu roku 2024 budeme postupně vyřazovat problémy z GitHub coby mechanismus zpětné vazby pro obsah a nahrazovat ho novým systémem zpětné vazby. Další informace naleznete v tématu:Odeslat a zobrazit názory pro