Bewerken

Delen via


ConcurrentDictionary<TKey,TValue>.IDictionary.Add Method

Definition

Adds the specified key and value to the dictionary.

 virtual void System.Collections.IDictionary.Add(System::Object ^ key, System::Object ^ value) = System::Collections::IDictionary::Add;
void IDictionary.Add (object key, object value);
abstract member System.Collections.IDictionary.Add : obj * obj -> unit
override this.System.Collections.IDictionary.Add : obj * obj -> unit
Sub Add (key As Object, value As Object) Implements IDictionary.Add

Parameters

key
Object

The object to use as the key.

value
Object

The object to use as the value.

Implements

Exceptions

key is null.

key is of a type that is not assignable to the key type of the Dictionary<TKey,TValue>.

-or-

value is of a type that is not assignable to the type of values in the Dictionary<TKey,TValue>.

-or-

A value with the same key already exists in the Dictionary<TKey,TValue>.

The dictionary contains too many elements.

Applies to

See also