public void Add(
TKey key,
TValue value
)
Public Sub Add (
key As TKey,
value As TValue
)
public:
virtual void Add(
TKey key,
TValue value
) sealed
abstract Add :
key : 'TKey *
value : 'TValue -> unit
override Add :
key : 'TKey *
value : 'TValue -> unit
In this dictionary both the key and the value can be .
You can also use the indexer to add new elements by setting the value of a key that does not exist in the AllowNullDictionaryTKey, TValue. for example:
myCollection[myNonexistentKey] = myValue;
This method approaches an O(1) operation unless if insertion causes a resize, in which case the operation is O(n).
ArgumentException | An element with the same key already exists in the AllowNullDictionaryTKey, TValue. |