ImmutableDictionary.CreateRangeWithOverwrite 方法

定义

重载

名称 说明
CreateRangeWithOverwrite<TKey,TValue>(IEqualityComparer<TKey>, ReadOnlySpan<KeyValuePair<TKey,TValue>>)

创建包含指定项并使用指定键比较器的新不可变字典。

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

创建包含指定项的新不可变字典。

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

Source:
ImmutableDictionary.cs
Source:
ImmutableDictionary.cs
Source:
ImmutableDictionary.cs

创建包含指定项并使用指定键比较器的新不可变字典。

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)

类型参数

TKey

字典中的键类型。

TValue

字典中的值类型。

参数

keyComparer
IEqualityComparer<TKey>

用于比较键相等性的比较器实现。

items
ReadOnlySpan<KeyValuePair<TKey,TValue>>

要添加到字典中的项在字典不可变之前。

返回

包含指定项并使用指定比较器的新不可变字典。

注解

与此 CreateRange<TKey,TValue>(IEqualityComparer<TKey>, IEnumerable<KeyValuePair<TKey,TValue>>)相反,如果集合中有 items 重复键,将使用最后一个键,而不是引发异常。

适用于

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

Source:
ImmutableDictionary.cs
Source:
ImmutableDictionary.cs
Source:
ImmutableDictionary.cs

创建包含指定项的新不可变字典。

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)

类型参数

TKey

字典中的键类型。

TValue

字典中的值类型。

参数

items
ReadOnlySpan<KeyValuePair<TKey,TValue>>

用于在字典不可变之前填充字典的项。

返回

包含指定项的新不可变字典。

注解

与此 CreateRange<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)相反,如果集合中有 items 重复键,将使用最后一个键,而不是引发异常。

适用于