Edit

Share via


FrozenDictionary.Create Method

Definition

Overloads

Create<TKey,TValue>(ReadOnlySpan<KeyValuePair<TKey,TValue>>)

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

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

public:
generic <typename TKey, typename TValue>
 static System::Collections::Frozen::FrozenDictionary<TKey, TValue> ^ Create(ReadOnlySpan<System::Collections::Generic::KeyValuePair<TKey, TValue>> source);
public static System.Collections.Frozen.FrozenDictionary<TKey,TValue> Create<TKey,TValue>(scoped ReadOnlySpan<System.Collections.Generic.KeyValuePair<TKey,TValue>> source);
static member Create : ReadOnlySpan<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Value>
Public Function Create(Of TKey, TValue) (source As ReadOnlySpan(Of KeyValuePair(Of TKey, TValue))) 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
ReadOnlySpan<KeyValuePair<TKey,TValue>>

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

Returns

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

Remarks

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

Applies to

Create<TKey,TValue>(IEqualityComparer<TKey>, ReadOnlySpan<KeyValuePair<TKey,TValue>>)

Source:
FrozenDictionary.cs
Source:
FrozenDictionary.cs

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

public:
generic <typename TKey, typename TValue>
 static System::Collections::Frozen::FrozenDictionary<TKey, TValue> ^ Create(System::Collections::Generic::IEqualityComparer<TKey> ^ comparer, ReadOnlySpan<System::Collections::Generic::KeyValuePair<TKey, TValue>> source);
public static System.Collections.Frozen.FrozenDictionary<TKey,TValue> Create<TKey,TValue>(System.Collections.Generic.IEqualityComparer<TKey>? comparer, scoped ReadOnlySpan<System.Collections.Generic.KeyValuePair<TKey,TValue>> source);
static member Create : System.Collections.Generic.IEqualityComparer<'Key> * ReadOnlySpan<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Value>
Public Function Create(Of TKey, TValue) (comparer As IEqualityComparer(Of TKey), source As ReadOnlySpan(Of KeyValuePair(Of TKey, TValue))) 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

comparer
IEqualityComparer<TKey>

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

source
ReadOnlySpan<KeyValuePair<TKey,TValue>>

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

Returns

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

Remarks

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

Applies to