แก้ไข

แชร์ผ่าน


JsonTypeInfo.CreateJsonTypeInfo Method

Definition

Overloads

CreateJsonTypeInfo(Type, JsonSerializerOptions)

Creates a blank JsonTypeInfo instance.

CreateJsonTypeInfo<T>(JsonSerializerOptions)

Creates a blank JsonTypeInfo<T> instance.

CreateJsonTypeInfo(Type, JsonSerializerOptions)

Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs

Creates a blank JsonTypeInfo instance.

public:
 static System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ CreateJsonTypeInfo(Type ^ type, System::Text::Json::JsonSerializerOptions ^ options);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateJsonTypeInfo (Type type, System.Text.Json.JsonSerializerOptions options);
static member CreateJsonTypeInfo : Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo
Public Shared Function CreateJsonTypeInfo (type As Type, options As JsonSerializerOptions) As JsonTypeInfo

Parameters

type
Type

The type for which contract metadata is specified.

options
JsonSerializerOptions

The JsonSerializerOptions instance the metadata is associated with.

Returns

A blank JsonTypeInfo instance.

Exceptions

type or options is null.

type cannot be used for serialization.

Remarks

The returned JsonTypeInfo will be blank, with the exception of the Converter property which will be resolved either from Converters or the built-in converters for the type. Any converters specified via JsonConverterAttribute on the type declaration will not be resolved by this method.

Which converter gets resolved influences the value of Kind, which constrains the type of metadata that can be modified in the JsonTypeInfo instance.

Applies to

CreateJsonTypeInfo<T>(JsonSerializerOptions)

Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs
Source:
JsonTypeInfo.cs

Creates a blank JsonTypeInfo<T> instance.

public:
generic <typename T>
 static System::Text::Json::Serialization::Metadata::JsonTypeInfo<T> ^ CreateJsonTypeInfo(System::Text::Json::JsonSerializerOptions ^ options);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> CreateJsonTypeInfo<T> (System.Text.Json.JsonSerializerOptions options);
static member CreateJsonTypeInfo : System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T>
Public Shared Function CreateJsonTypeInfo(Of T) (options As JsonSerializerOptions) As JsonTypeInfo(Of T)

Type Parameters

T

The type for which contract metadata is specified.

Parameters

options
JsonSerializerOptions

The JsonSerializerOptions instance the metadata is associated with.

Returns

A blank JsonTypeInfo<T> instance.

Exceptions

options is null.

Remarks

The returned <see cref="T:System.Text.Json.Serialization.Metadata.JsonTypeInfo`1> will be blank, with the exception of the Converter property, which will be resolved either from Converters or the built-in converters for the type. Any converters specified via JsonConverterAttribute on the type declaration will not be resolved by this method.

Which converter gets resolved influences the value of Kind, which constrains the type of metadata that can be modified in the JsonTypeInfo instance.

Applies to