共用方式為


FrozenDictionary.ToFrozenDictionary 方法

定義

多載

ToFrozenDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)

FrozenDictionary<TKey,TValue>使用指定的索引鍵/ 值群組建立 。

ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

根據指定的索引鍵選取器和項目選取器函式,從 FrozenDictionary<TKey,TValue> 建立 IEnumerable<T>

ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

FrozenDictionary<TKey,TValue>根據指定的索引鍵選取器函式,從 IEnumerable<T> 建立 。

ToFrozenDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)

來源:
FrozenDictionary.cs
來源:
FrozenDictionary.cs

FrozenDictionary<TKey,TValue>使用指定的索引鍵/ 值群組建立 。

public static System.Collections.Frozen.FrozenDictionary<TKey,TValue> ToFrozenDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Value>
<Extension()>
Public Function ToFrozenDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TValue)

類型參數

TKey

字典中的索引鍵類型。

TValue

字典中的值類型。

參數

source
IEnumerable<KeyValuePair<TKey,TValue>>

要用來填入字典的索引鍵/值組。

comparer
IEqualityComparer<TKey>

用於比較索引鍵是否相等的比較子實作。 如果為 null,則會使用 Default

傳回

FrozenDictionary<TKey,TValue>,包含指定的索引鍵和值。

備註

如果輸入中出現相同索引鍵多次,序列中的最後一個索引鍵會優先。 這與 ToDictionary不同,其中重複的索引鍵會導致例外狀況。

適用於

ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

來源:
FrozenDictionary.cs
來源:
FrozenDictionary.cs

根據指定的索引鍵選取器和項目選取器函式,從 FrozenDictionary<TKey,TValue> 建立 IEnumerable<T>

public static System.Collections.Frozen.FrozenDictionary<TKey,TElement> ToFrozenDictionary<TSource,TKey,TElement> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Element>
<Extension()>
Public Function ToFrozenDictionary(Of TSource, TKey, TElement) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TElement)

類型參數

TSource

source 項目的類型。

TKey

keySelector 所傳回之索引鍵的型別。

TElement

elementSelector 所傳回值的型別。

參數

source
IEnumerable<TSource>

IEnumerable<T> 要從中建立 FrozenDictionary<TKey,TValue>

keySelector
Func<TSource,TKey>

用來從各個項目擷取索引鍵的函式。

elementSelector
Func<TSource,TElement>

用來從每個項目產生結果項目值的轉換函式。

comparer
IEqualityComparer<TKey>

用來比較金鑰的 IEqualityComparer<T>

傳回

FrozenDictionary<TKey,TElement>

FrozenDictionary<TKey,TValue> 其中包含從輸入序列選取的索引鍵和值。

適用於

ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

來源:
FrozenDictionary.cs
來源:
FrozenDictionary.cs

FrozenDictionary<TKey,TValue>根據指定的索引鍵選取器函式,從 IEnumerable<T> 建立 。

public static System.Collections.Frozen.FrozenDictionary<TKey,TSource> ToFrozenDictionary<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Source>
<Extension()>
Public Function ToFrozenDictionary(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TSource)

類型參數

TSource

source 項目的類型。

TKey

keySelector 所傳回之索引鍵的型別。

參數

source
IEnumerable<TSource>

IEnumerable<T> 要從中建立 FrozenDictionary<TKey,TValue>

keySelector
Func<TSource,TKey>

用來從各個項目擷取索引鍵的函式。

comparer
IEqualityComparer<TKey>

用來比較金鑰的 IEqualityComparer<T>

傳回

FrozenDictionary<TKey,TSource>

FrozenDictionary<TKey,TValue> 其中包含從輸入序列選取的索引鍵和值。

適用於