JsonSerializerOptions.TryGetTypeInfo Méthode

Définition

Surcharges

Nom Description
TryGetTypeInfo(Type, JsonTypeInfo)

Tente d’obtenir les métadonnées de JsonTypeInfo contrat résolues par l’instance actuelle JsonSerializerOptions .

TryGetTypeInfo<T>(JsonTypeInfo<T>)

TryGetTypeInfo(Type, JsonTypeInfo)

Source:
JsonSerializerOptions.Caching.cs
Source:
JsonSerializerOptions.Caching.cs
Source:
JsonSerializerOptions.Caching.cs
Source:
JsonSerializerOptions.Caching.cs
Source:
JsonSerializerOptions.Caching.cs
Source:
JsonSerializerOptions.Caching.cs

Tente d’obtenir les métadonnées de JsonTypeInfo contrat résolues par l’instance actuelle JsonSerializerOptions .

public:
 bool TryGetTypeInfo(Type ^ type, [Runtime::InteropServices::Out] System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ % typeInfo);
public bool TryGetTypeInfo(Type type, out System.Text.Json.Serialization.Metadata.JsonTypeInfo? typeInfo);
member this.TryGetTypeInfo : Type * JsonTypeInfo -> bool
Public Function TryGetTypeInfo (type As Type, ByRef typeInfo As JsonTypeInfo) As Boolean

Paramètres

type
Type

Type pour lequel résoudre les métadonnées de contrat.

typeInfo
JsonTypeInfo

Lorsque cette méthode est retournée, contient les métadonnées de contrat résolues ou null si le contrat n’a pas pu être résolu.

Retours

true si un contrat a type été trouvé ou false autrement.

Exceptions

type a la valeur null.

type n’est pas valide pour la sérialisation.

Remarques

Les métadonnées retournées peuvent être mises en JsonTypeInfo<T> panne et utilisées avec les surcharges pertinentes JsonSerializer .

Si l’instance JsonSerializerOptions est verrouillée pour modification, la méthode retourne une instance mise en cache pour les métadonnées.

S’applique à

TryGetTypeInfo<T>(JsonTypeInfo<T>)

Source:
JsonSerializerOptions.Caching.cs
public:
generic <typename T>
 bool TryGetTypeInfo([Runtime::InteropServices::Out] System::Text::Json::Serialization::Metadata::JsonTypeInfo<T> ^ % typeInfo);
public bool TryGetTypeInfo<T>(out System.Text.Json.Serialization.Metadata.JsonTypeInfo<T>? typeInfo);
member this.TryGetTypeInfo : JsonTypeInfo -> bool
Public Function TryGetTypeInfo(Of T) (ByRef typeInfo As JsonTypeInfo(Of T)) As Boolean

Paramètres de type

T

Paramètres

typeInfo
JsonTypeInfo<T>

Retours

S’applique à