This documentation is archived and is not being maintained.

ArrangedElementCollection.CopyTo Method

Note: This method is new in the .NET Framework version 2.0.

Copies the entire contents of this collection to a compatible one-dimensional Array, starting at the specified index of the target array.

Namespace: System.Windows.Forms.Layout
Assembly: System.Windows.Forms (in

public void CopyTo (
	Array array,
	int index
public final void CopyTo (
	Array array, 
	int index
public final function CopyTo (
	array : Array, 
	index : int



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


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

Exception typeCondition


array is a null reference (Nothing in Visual Basic).


index is less than 0.


One of the following conditions has occurred:

  • array is multidimensional.

  • index is equal to or greater than the length of array.

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


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

The type of the specified array must be compatible with the source collection.

This method uses the Array.Copy method to copy the elements.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0