A key cannot be nullNothingnullptra null reference (Nothing in Visual Basic), but a value can be, if the type of values in the sorted list, TValue, is a reference type.
You can also use the Item property to add new elements by setting the value of a key that does not exist in the SortedList<(Of <(TKey, TValue>)>); for example, myCollection["myNonexistentKey"] = myValue. However, if the specified key already exists in the SortedList<(Of <(TKey, TValue>)>), setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements.
If Count already equals Capacity, the capacity of the SortedList<(Of <(TKey, TValue>)>) is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.
This method is an O(n) operation for unsorted data, where n is Count. It is an O(log n) operation if the new element is added at the end of the list. If insertion causes a resize, the operation is O(n).