CopyTo Method (Array, Int32)
Collapse the table of content
Expand the table of content

AutomationElementCollection.CopyTo Method (Array, Int32)


Copies the collection's elements to an array, starting at the specified index in the target array.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public virtual void CopyTo(
	Array array,
	int index


Type: System.Array

The destination of the elements copied from the collection.

Type: System.Int32

The zero-based index in the target array where copying should begin.

The following example shows how to copy an AutomationElementCollection to an array of objects.

// elementCollection is an AutomationElementCollection.
object[] elementUntypedArray = new object[elementCollection.Count];
elementCollection.CopyTo(elementUntypedArray, 0);

.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft