Rediger

Del via


JsonSerializerOptions.GetTypeInfo(Type) Method

Definition

Gets the JsonTypeInfo contract metadata resolved by the current JsonSerializerOptions instance.

public:
 System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ GetTypeInfo(Type ^ type);
public System.Text.Json.Serialization.Metadata.JsonTypeInfo GetTypeInfo (Type type);
member this.GetTypeInfo : Type -> System.Text.Json.Serialization.Metadata.JsonTypeInfo
Public Function GetTypeInfo (type As Type) As JsonTypeInfo

Parameters

type
Type

The type to resolve contract metadata for.

Returns

The contract metadata resolved for type.

Exceptions

type is null.

type is not valid for serialization.

Remarks

Returned metadata can be downcast to JsonTypeInfo<T> and used with the relevant JsonSerializer overloads.

If the JsonSerializerOptions instance is locked for modification, the method returns a cached instance for the metadata.

Applies to