Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Array.CopyTo Method

Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index. The index is specified as a 32-bit integer.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public void CopyTo(
	Array array,
	int index


Type: System.Array
The one-dimensional Array that is the destination of the elements copied from the current Array.
Type: System.Int32
A 32-bit integer that represents the index in array at which copying begins.


ICollection.CopyTo(Array, Int32)


array is null.


index is less than the lower bound of array.


array is multidimensional.


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


The type of the source Array cannot be cast automatically to the type of the destination array.


The source Array is multidimensional.


At least one element in the source Array cannot be cast to the type of destination array.

This method supports the System.Collections.ICollection interface. If implementing System.Collections.ICollection is not explicitly required, use Copy to avoid an extra indirection.

If this method throws an exception while copying, the state of array is undefined.

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


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

© 2015 Microsoft