JsonSerializerOptions.GetTypeInfo 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| GetTypeInfo(Type) |
讓 JsonTypeInfo 合約的元資料由目前 JsonSerializerOptions 實例解析。 |
| GetTypeInfo<T>() |
GetTypeInfo(Type)
讓 JsonTypeInfo 合約的元資料由目前 JsonSerializerOptions 實例解析。
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
參數
- type
- Type
要解決合約元資料的類型。
傳回
合約元資料解析為 type。
例外狀況
type 是 null。
type 不適用於序列化。
備註
回傳的元資料可以下傳到 JsonTypeInfo<T> 相關 JsonSerializer 超載區並使用。
若 JsonSerializerOptions 實例被鎖定以供修改,方法會回傳一個快取的實例作為元資料。
適用於
GetTypeInfo<T>()
public:
generic <typename T>
System::Text::Json::Serialization::Metadata::JsonTypeInfo<T> ^ GetTypeInfo();
public System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> GetTypeInfo<T>();
member this.GetTypeInfo : unit -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T>
Public Function GetTypeInfo(Of T) () As JsonTypeInfo(Of T)
類型參數
- T