TextElementCollection.CopyTo Method

Copies the contents of the collection and inserts them into a specified array starting at a specified index position in the array.

Namespace: System.Windows.Documents
Assembly: PresentationFramework (in presentationframework.dll)

public void CopyTo (
	TextElementType[] array,
	int arrayIndex
public final void CopyTo (
	TextElementType[] array, 
	int arrayIndex
public final function CopyTo (
	array : TextElementType[], 
	arrayIndex : int
You cannot use methods in XAML.



A one-dimensional array to which the collection contents will be copied. This array must use zero-based indexing.


A zero-based index in array specifying the position at which to begin inserting the copied collection objects.

Exception typeCondition


Raised when array includes items that are not compatible with the type TextElement, or if arrayIndex specifies a position that falls outside of the bounds of array.


Raised when array is null.


Raised when arrayIndex is less than 0.

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions