SortedDictionary<TKey, TValue>.ValueCollection.CopyTo Method (TValue[], Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Copies the SortedDictionary<TKey, TValue>.ValueCollection elements to an existing one-dimensional array, starting at the specified array index.

Namespace:   System.Collections.Generic
Assembly:  System (in System.dll)

public void CopyTo(
	TValue[] array,
	int index


Type: TValue[]

The one-dimensional array that is the destination of the elements copied from the SortedDictionary<TKey, TValue>.ValueCollection. The array must have zero-based indexing.

Type: System.Int32

The zero-based index in array at which copying begins.

Exception Condition

array is null.


index is less than 0.


The number of elements in the source SortedDictionary<TKey, TValue>.ValueCollection 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>.ValueCollection.

This method is an O(n) operation, where n is Count.

Universal Windows Platform
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
Return to top