語言

ImmutableSortedDictionary<TKey,TValue>.Add(TKey, TValue) 方法

定義

將具有指定索引鍵和值的 元素加入至不可變的排序字典。

public:
 System::Collections::Immutable::ImmutableSortedDictionary<TKey, TValue> ^ Add(TKey key, TValue value);
public System.Collections.Immutable.ImmutableSortedDictionary<TKey,TValue> Add(TKey key, TValue value);
member this.Add : 'Key * 'Value -> System.Collections.Immutable.ImmutableSortedDictionary<'Key, 'Value>
Public Function Add (key As TKey, value As TValue) As ImmutableSortedDictionary(Of TKey, TValue)

參數

key
TKey

新增的重點是。

value
TValue

進入的價值是額外的。

傳回

一個新的不可變排序字典,包含額外的鍵值對。

例外狀況

給定的鍵已存在於字典中,但值不同。

備註

若該鍵值對已存在於字典中,則回傳字典的現有實例。

適用於