語言

JsonMetadataServices.CreateImmutableEnumerableInfo<TCollection,TElement> 方法

定義

為非字典不可變的集合類型建立元資料。

public:
generic <typename TCollection, typename TElement>
 where TCollection : System::Collections::Generic::IEnumerable<TElement> static System::Text::Json::Serialization::Metadata::JsonTypeInfo<TCollection> ^ CreateImmutableEnumerableInfo(System::Text::Json::JsonSerializerOptions ^ options, System::Text::Json::Serialization::Metadata::JsonCollectionInfoValues<TCollection> ^ collectionInfo, Func<System::Collections::Generic::IEnumerable<TElement> ^, TCollection> ^ createRangeFunc);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo<TCollection> CreateImmutableEnumerableInfo<TCollection,TElement>(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<TCollection> collectionInfo, Func<System.Collections.Generic.IEnumerable<TElement>,TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IEnumerable<TElement>;
static member CreateImmutableEnumerableInfo : System.Text.Json.JsonSerializerOptions * System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues<#seq<'Element>> * Func<seq<'Element>, #seq<'Element>> -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<#seq<'Element>>
Public Shared Function CreateImmutableEnumerableInfo(Of TCollection As IEnumerable(Of TElement), TElement As IEnumerable(Of TElement)) (options As JsonSerializerOptions, collectionInfo As JsonCollectionInfoValues(Of TCollection), createRangeFunc As Func(Of IEnumerable(Of TElement), TCollection)) As JsonTypeInfo(Of TCollection)

類型參數

TCollection

這是該類型的通用定義。

TElement

元素類型的通用定義。

參數

options
JsonSerializerOptions

用於 JsonSerializerOptions 序列化與反序列化。

collectionInfo
JsonCollectionInfoValues<TCollection>

提供關於集合類型的序列化元資料。

createRangeFunc
Func<IEnumerable<TElement>,TCollection>

一種建立不可變字典實例的方法。

傳回

JsonTypeInfo<TCollection>

針對特定類型的序列化元資料。

備註

此 API 供 System.Text.Json 原始碼產生器的輸出使用,不應直接呼叫。

適用於