Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CopyTo Method

ReadOnlyDictionary<TKey, TValue>.KeyCollection.CopyTo Method

.NET Framework 4.6 and 4.5

Copies the elements of the collection to an array, starting at a specific array index.

Namespace:  System.Collections.ObjectModel
Assemblies:   mscorlib (in mscorlib.dll)
  System.ObjectModel (in System.ObjectModel.dll)

public void CopyTo(
	TKey[] array,
	int arrayIndex
)

Parameters

array
Type: TKey[]

The one-dimensional array that is the destination of the elements copied from the collection. The array must have zero-based indexing.

arrayIndex
Type: System.Int32

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

Implements

ICollection<T>.CopyTo(T[], Int32)

ExceptionCondition
ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

array is multidimensional.

-or-

The number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array.

-or-

Type T cannot be cast automatically to the type of the destination array.

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
Show:
© 2015 Microsoft