SortedDictionary(Of TKey, TValue).CopyTo Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Copies the elements of the SortedDictionary(Of TKey, TValue) to the specified array of KeyValuePair(Of TKey, TValue) structures, starting at the specified index.
Assembly: System (in System.dll)
'Declaration Public Sub CopyTo ( _ array As KeyValuePair(Of TKey, TValue)(), _ index As Integer _ )
Parameters
- array
- Type:
System.Collections.Generic.KeyValuePair(Of TKey, TValue)
()
The one-dimensional array of KeyValuePair(Of TKey, TValue) structures that is the destination of the elements copied from the current SortedDictionary(Of TKey, TValue) The array must have zero-based indexing.
- index
- Type: System.Int32
The zero-based index in array at which copying begins.
Implements
ICollection(Of T).CopyTo(T(), Int32)| Exception | Condition |
|---|---|
| ArgumentNullException | array is Nothing. |
| ArgumentOutOfRangeException | index is less than 0. |
| ArgumentException | The number of elements in the source SortedDictionary(Of TKey, TValue) is greater than the available space from index to the end of the destination array. |
Note: |
|---|
If the type of the source SortedDictionary(Of TKey, TValue) cannot be cast automatically to the type of the destination array, the nongeneric implementations of ICollection.CopyTo throw InvalidCastException, whereas the generic implementations throw ArgumentException. |
This method is an O(n) operation, where n is Count.
Note: