SortedDictionary(Of TKey, TValue).ICollection(Of KeyValuePair(Of TKey, TValue)).Add Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Adds an item to the ICollection(Of T).
Assembly: System (in System.dll)
'Declaration Private Sub Add ( _ keyValuePair As KeyValuePair(Of TKey, TValue) _ ) Implements ICollection(Of KeyValuePair(Of TKey, TValue)).Add
Parameters
- keyValuePair
- Type: System.Collections.Generic.KeyValuePair(Of TKey, TValue)
The KeyValuePair(Of TKey, TValue) structure to add to the ICollection(Of T).
Implements
ICollection(Of T).Add(T)| Exception | Condition |
|---|---|
| ArgumentNullException | keyValuePair is Nothing. |
| ArgumentException | An element with the same key already exists in the SortedDictionary(Of TKey, TValue). |
A key cannot be Nothing, but a value can be, if the value type TValue is a reference type.
This method is an O(log n) operation, where n is Count.
Show: