JsonConverterAttribute Sınıf

Tanım

Bir özelliğe veya türe yerleştirildiğinde kullanılacak dönüştürücü türünü belirtir.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
Devralma
JsonConverterAttribute
Öznitelikler

Açıklamalar

Belirtilen dönüştürücü türü öğesinden türetilmelidir JsonConverter .The specified converter type must derive from JsonConverter.

Bir özelliğe yerleştirildiğinde, belirtilen dönüştürücü her zaman kullanılacaktır.When placed on a property, the specified converter will always be used.

Bir türe yerleştirildiğinde, koleksiyona uyumlu bir dönüştürücü eklenmediği JsonSerializerOptions.Converters veya aynı türdeki bir özellikte başka bir özellik varsa, belirtilen dönüştürücü kullanılacaktır JsonConverterAttribute .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.

Daha fazla bilgi için bkz. JSON serileştirme için özel dönüştürücüler yazma.For more information, see How to write custom converters for JSON serialization.

Oluşturucular

JsonConverterAttribute()

Yeni bir örneğini başlatır JsonConverterAttribute .Initializes a new instance of JsonConverterAttribute.

JsonConverterAttribute(Type)

Belirtilen dönüştürücü türüyle yeni bir örneğini başlatır JsonConverterAttribute .Initializes a new instance of JsonConverterAttribute with the specified converter type.

Özellikler

ConverterType

Türünü alır JsonConverterAttribute veya null bir tür olmadan oluşturulmuşsa.Gets the type of the JsonConverterAttribute, or null if it was created without a type.

TypeId

Türetilmiş bir sınıfta uygulandığında, bunun için benzersiz bir tanımlayıcı alır Attribute .When implemented in a derived class, gets a unique identifier for this Attribute.

(Devralındığı yer: Attribute)

Yöntemler

CreateConverter(Type)

Türetilmiş bir sınıfta ve olduğu zaman geçersiz kılınırsa ConverterType null , daha JsonConverter fazla durum geçirmek için türetilmiş sınıfın bir oluşturmasını sağlar.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)

Bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değeri döndürür.Returns a value that indicates whether this instance is equal to a specified object.

(Devralındığı yer: Attribute)
GetHashCode()

Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance.

(Devralındığı yer: Attribute)
GetType()

TypeGeçerli örneği alır.Gets the Type of the current instance.

(Devralındığı yer: Object)
IsDefaultAttribute()

Türetilmiş bir sınıfta geçersiz kılınırsa, bu örneğin değerinin türetilmiş sınıf için varsayılan değer olup olmadığını gösterir.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Devralındığı yer: Attribute)
Match(Object)

Türetilmiş bir sınıfta geçersiz kılınırsa, bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değer döndürür.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Devralındığı yer: Attribute)
MemberwiseClone()

Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.Returns a string that represents the current object.

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

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

Bir ad kümesini karşılık gelen bir dağıtma tanımlayıcısı kümesine eşler.Maps a set of names to a corresponding set of dispatch identifiers.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Bir arabirimin tür bilgilerini almak için kullanılabilen bir nesnenin tür bilgilerini alır.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Bir nesnenin sağladığı tür bilgisi arabirimlerinin sayısını alır (0 ya da 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Devralındığı yer: Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Bir nesne tarafından sunulan özelliklere ve yöntemlere erişim sağlar.Provides access to properties and methods exposed by an object.

(Devralındığı yer: Attribute)

Şunlara uygulanır