JsonConverterAttribute Clase

Definición

Cuando se coloca en una propiedad o tipo, especifica el tipo de convertidor que se usará.When placed on a property or type, specifies the converter type to use.

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
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
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
Herencia
JsonConverterAttribute
Atributos

Comentarios

El tipo de convertidor especificado debe derivar de JsonConverter .The specified converter type must derive from JsonConverter.

Cuando se coloca en una propiedad, se utilizará siempre el convertidor especificado.When placed on a property, the specified converter will always be used.

Cuando se coloca en un tipo, se usará el convertidor especificado, a menos que se agregue un convertidor compatible a la JsonSerializerOptions.Converters colección o que haya otro JsonConverterAttribute en una propiedad del mismo tipo.When placed on a type, the specified converter will be used unless a compatible converter is added to the JsonSerializerOptions.Converters collection or there is another JsonConverterAttribute on a property of the same type.

Para obtener más información, vea Cómo escribir convertidores personalizados para la serialización de JSON.For more information, see How to write custom converters for JSON serialization.

Constructores

JsonConverterAttribute()

Inicializa una nueva instancia de la clase JsonConverterAttribute.Initializes a new instance of JsonConverterAttribute.

JsonConverterAttribute(Type)

Inicializa una nueva instancia de JsonConverterAttribute con el tipo de convertidor especificado.Initializes a new instance of JsonConverterAttribute with the specified converter type.

Propiedades

ConverterType

Obtiene el tipo de JsonConverterAttribute, o bien null si se ha creado sin un tipo.Gets the type of the JsonConverterAttribute, or null if it was created without a type.

TypeId

Cuando se implementa en una clase derivada, obtiene un identificador único para este Attribute.When implemented in a derived class, gets a unique identifier for this Attribute.

(Heredado de Attribute)

Métodos

CreateConverter(Type)

Cuando se reemplaza en una clase derivada y ConverterType es null, permite que la clase derivada cree un JsonConverter para pasar el estado adicional.When overridden in a derived class and ConverterType is null, allows the derived class to create a JsonConverter in order to pass additional state.

Equals(Object)

Devuelve un valor que indica si esta instancia es igual que un objeto especificado.Returns a value that indicates whether this instance is equal to a specified object.

(Heredado de Attribute)
GetHashCode()

Devuelve el código hash de esta instancia.Returns the hash code for this instance.

(Heredado de Attribute)
GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Heredado de Object)
IsDefaultAttribute()

Si se reemplaza en una clase derivada, indica si el valor de esta instancia es el valor predeterminado de la clase derivada.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Heredado de Attribute)
Match(Object)

Cuando se invalida en una clase derivada, devuelve un valor que indica si esta instancia es igual a un objeto especificado.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Heredado de Attribute)
MemberwiseClone()

Crea una copia superficial del Object actual.Creates a shallow copy of the current Object.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Heredado de Object)

Implementaciones de interfaz explícitas

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Asigna un conjunto de nombres a un conjunto correspondiente de identificadores de envío.Maps a set of names to a corresponding set of dispatch identifiers.

(Heredado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Obtiene la información de tipos de un objeto, que puede utilizarse para obtener la información de tipos de una interfaz.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Heredado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Recupera el número de interfaces de información de tipo que proporciona un objeto (0 ó 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Heredado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Proporciona acceso a las propiedades y los métodos expuestos por un objeto.Provides access to properties and methods exposed by an object.

(Heredado de Attribute)

Se aplica a