Edytuj

Udostępnij za pośrednictwem


FrozenDictionary.ToFrozenDictionary Method

Definition

Overloads

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

Creates a FrozenDictionary<TKey,TValue> with the specified key/value pairs.

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

Creates a FrozenDictionary<TKey,TValue> from an IEnumerable<T> according to specified key selector and element selector functions.

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

Creates a FrozenDictionary<TKey,TValue> from an IEnumerable<T> according to specified key selector function.

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

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

Creates a FrozenDictionary<TKey,TValue> with the specified key/value pairs.

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)

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Parameters

source
IEnumerable<KeyValuePair<TKey,TValue>>

The key/value pairs to use to populate the dictionary.

comparer
IEqualityComparer<TKey>

The comparer implementation to use to compare keys for equality. If null, Default is used.

Returns

A FrozenDictionary<TKey,TValue> that contains the specified keys and values.

Remarks

If the same key appears multiple times in the input, the last one in the sequence takes precedence. This differs from ToDictionary, where duplicate keys result in an exception.

Applies to

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

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

Creates a FrozenDictionary<TKey,TValue> from an IEnumerable<T> according to specified key selector and element selector functions.

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)

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the key returned by keySelector.

TElement

The type of the value returned by elementSelector.

Parameters

source
IEnumerable<TSource>

An IEnumerable<T> from which to create a FrozenDictionary<TKey,TValue>.

keySelector
Func<TSource,TKey>

A function to extract a key from each element.

elementSelector
Func<TSource,TElement>

A transform function to produce a result element value from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

Returns

FrozenDictionary<TKey,TElement>

A FrozenDictionary<TKey,TValue> that contains the keys and values selected from the input sequence.

Applies to

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

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

Creates a FrozenDictionary<TKey,TValue> from an IEnumerable<T> according to specified key selector function.

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)

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the key returned by keySelector.

Parameters

source
IEnumerable<TSource>

An IEnumerable<T> from which to create a FrozenDictionary<TKey,TValue>.

keySelector
Func<TSource,TKey>

A function to extract a key from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

Returns

FrozenDictionary<TKey,TSource>

A FrozenDictionary<TKey,TValue> that contains the keys and values selected from the input sequence.

Applies to