ImmutableDictionary.CreateRangeWithOverwrite 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| 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>>)
建立一個新的不可變字典,包含指定的項目並使用指定的金鑰比較器。
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>>)
建立一個新的不可變字典,包含指定的項目。
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 重複鍵,則會使用最後一個鍵,而非拋出例外。