JsonSerializerOptions.GetTypeInfo(Type) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.