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>)

根据指定的键选择器和元素选择器函数,从 IEnumerable<T> 创建一个 FrozenDictionary<TKey,TValue>

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

FrozenDictionary<TKey,TValue>根据指定的键选择器函数从 IEnumerable<T> 创建 。

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

Source:
FrozenDictionary.cs
Source:
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>)

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

根据指定的键选择器和元素选择器函数,从 IEnumerable<T> 创建一个 FrozenDictionary<TKey,TValue>

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>)

Source:
FrozenDictionary.cs
Source:
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> ,它包含从输入序列中选择的键和值。

适用于