Edit

Share via


ImmutableDictionary.CreateRangeWithOverwrite Method

Definition

Overloads

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

Creates a new immutable dictionary that contains the specified items and uses the specified key comparer.

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

Creates a new immutable dictionary that contains the specified items.

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

Source:
ImmutableDictionary.cs

Creates a new immutable dictionary that contains the specified items and uses the specified key comparer.

public:
generic <typename TKey, typename TValue>
 static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ CreateRangeWithOverwrite(System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer, ReadOnlySpan<System::Collections::Generic::KeyValuePair<TKey, TValue>> items);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> CreateRangeWithOverwrite<TKey,TValue>(System.Collections.Generic.IEqualityComparer<TKey>? keyComparer, scoped ReadOnlySpan<System.Collections.Generic.KeyValuePair<TKey,TValue>> items);
static member CreateRangeWithOverwrite : System.Collections.Generic.IEqualityComparer<'Key> * ReadOnlySpan<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function CreateRangeWithOverwrite(Of TKey, TValue) (keyComparer As IEqualityComparer(Of TKey), items As ReadOnlySpan(Of KeyValuePair(Of TKey, TValue))) As ImmutableDictionary(Of TKey, TValue)

Type Parameters

TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Parameters

keyComparer
IEqualityComparer<TKey>

The comparer implementation to use to compare keys for equality.

items
ReadOnlySpan<KeyValuePair<TKey,TValue>>

The items to add to the dictionary before it's immutable.

Returns

A new immutable dictionary that contains the specified items and uses the specified comparer.

Remarks

In contrast to CreateRange<TKey,TValue>(IEqualityComparer<TKey>, IEnumerable<KeyValuePair<TKey,TValue>>), if there are duplicate keys in the items collection, the last one will be used, rather than an exception being thrown.

Applies to

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

Source:
ImmutableDictionary.cs

Creates a new immutable dictionary that contains the specified items.

public:
generic <typename TKey, typename TValue>
 static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ CreateRangeWithOverwrite(ReadOnlySpan<System::Collections::Generic::KeyValuePair<TKey, TValue>> items);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> CreateRangeWithOverwrite<TKey,TValue>(scoped ReadOnlySpan<System.Collections.Generic.KeyValuePair<TKey,TValue>> items);
static member CreateRangeWithOverwrite : ReadOnlySpan<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function CreateRangeWithOverwrite(Of TKey, TValue) (items As ReadOnlySpan(Of KeyValuePair(Of TKey, TValue))) As ImmutableDictionary(Of TKey, TValue)

Type Parameters

TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Parameters

items
ReadOnlySpan<KeyValuePair<TKey,TValue>>

The items used to populate the dictionary before it's immutable.

Returns

A new immutable dictionary that contains the specified items.

Remarks

In contrast to CreateRange<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>), if there are duplicate keys in the items collection, the last one will be used, rather than an exception being thrown.

Applies to