OrderedDictionaryTKey, TValueAdd Method (TKey, TValue) |
Adds a new key and value to the dictionary. If the dictionary already contains
a key equal to the passed key, then an ArgumentException is thrown
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic override sealed void Add(
TKey key,
TValue value
)
public:
virtual void Add(
TKey key,
TValue value
) override sealed
Parameters
- key
- Type: TKey
The new key. "null" is a valid key value. - value
- Type: TValue
The new value to associated with that key.
Implements
IDictionaryTKey, TValueAdd(TKey, TValue)
Exceptions
RemarksEquality between keys is determined by the comparison instance or delegate used
to create the dictionary.
Adding an key and value takes time O(log N), where N is the number of keys in the dictionary.
See Also