JsonMetadataServices.CreateImmutableDictionaryInfo<TCollection,TKey,TValue> 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 的 ImmutableDictionary<TKey,TValue> 元資料及可指派給 IReadOnlyDictionary<TKey,TValue>的類型。
public:
generic <typename TCollection, typename TKey, typename TValue>
where TCollection : System::Collections::Generic::IReadOnlyDictionary<TKey, TValue> static System::Text::Json::Serialization::Metadata::JsonTypeInfo<TCollection> ^ CreateImmutableDictionaryInfo(System::Text::Json::JsonSerializerOptions ^ options, System::Text::Json::Serialization::Metadata::JsonCollectionInfoValues<TCollection> ^ collectionInfo, Func<System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^, TCollection> ^ createRangeFunc);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCollection> CreateImmutableDictionaryInfo<TCollection,TKey,TValue>(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<TCollection> collectionInfo, Func<System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>,TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>;
static member CreateImmutableDictionaryInfo : System.Text.Json.JsonSerializerOptions * System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<'Collection (requires 'Collection :> System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value>)> * Func<seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>>, 'Collection (requires 'Collection :> System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value>)> -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Collection (requires 'Collection :> System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value>)> (requires 'Collection :> System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value>)
Public Shared Function CreateImmutableDictionaryInfo(Of TCollection As IReadOnlyDictionary(Of TKey, TValue), TKey As IReadOnlyDictionary(Of TKey, TValue), TValue As IReadOnlyDictionary(Of TKey, TValue)) (options As JsonSerializerOptions, collectionInfo As JsonCollectionInfoValues(Of TCollection), createRangeFunc As Func(Of IEnumerable(Of KeyValuePair(Of TKey, TValue)), TCollection)) As JsonTypeInfo(Of TCollection)
類型參數
- TCollection
這是該類型的通用定義。
- TKey
金鑰類型的通用定義。
- TValue
價值類型的通用定義。
參數
- options
- JsonSerializerOptions
用於 JsonSerializerOptions 序列化與反序列化。
- collectionInfo
- JsonCollectionInfoValues<TCollection>
提供關於集合類型的序列化元資料。
- createRangeFunc
- Func<IEnumerable<KeyValuePair<TKey,TValue>>,TCollection>
一種建立不可變字典實例的方法。
傳回
JsonTypeInfo<TCollection>
針對特定類型的序列化元資料。
備註
此 API 供 System.Text.Json 原始碼產生器的輸出使用,不應直接呼叫。