SortedDictionary<TKey, TValue>.KeyCollection.CopyTo Method (TKey[], Int32)
Copies the SortedDictionary<TKey, TValue>.KeyCollection elements to an existing one-dimensional array, starting at the specified array index.
Assembly: System (in System.dll)
Parameters
- array
-
Type:
TKey[]
The one-dimensional array that is the destination of the elements copied from the SortedDictionary<TKey, TValue>.KeyCollection. The array must have zero-based indexing.
- index
-
Type:
System.Int32
The zero-based index in array at which copying begins.
Implements
ICollection<T>.CopyTo(T[], Int32)| Exception | Condition |
|---|---|
| ArgumentNullException | array is null. |
| ArgumentOutOfRangeException | index is less than 0. |
| ArgumentException | The number of elements in the source SortedDictionary<TKey, TValue>.KeyCollection is greater than the available space from index to the end of the destination array. |
The elements are copied to the array in the same order in which the enumerator iterates through the SortedDictionary<TKey, TValue>.KeyCollection.
This method is an O(n) operation, where n is Count.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1