ImmutableSortedDictionary<TKey,TValue>.Add(TKey, TValue) 方法
定义
将具有指定键和值的元素添加到不可变排序字典。Adds an element with the specified key and value to the immutable sorted dictionary.
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
要添加的条目的键。The key of the entry to add.
- value
- TValue
要添加的条目的值。The value of entry to add.
返回
一个新的不可变排序字典,其中包含其他键/值对。A new immutable sorted dictionary that contains the additional key/value pair.
例外
字典中已存在给定的键,但具有不同的值。The given key already exists in the dictionary but has a different value.
注解
如果字典中已存在给定的键/值对,则返回字典的现有实例。If the given key/value pair already exists in the dictionary, the existing instance of the dictionary is returned.