ContextNodeCollection.CopyTo Method
Copies all elements of the current ContextNodeCollection to a specified one-dimensional array, using the specified destination array's index.
Namespace: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Syntax
'Declaration
Public Sub CopyTo ( _
array As ContextNode(), _
index As Integer _
)
'Usage
Dim instance As ContextNodeCollection
Dim array As ContextNode()
Dim index As Integer
instance.CopyTo(array, index)
public void CopyTo(
ContextNode[] array,
int index
)
public:
void CopyTo(
array<ContextNode^>^ array,
int index
)
public function CopyTo(
array : ContextNode[],
index : int
)
Parameters
array
Type: array<System.Windows.Ink.ContextNode[]The one-dimensional array that receives elements copied from the collection. The array must have zero-based indexing.
index
Type: System.Int32The zero-based index in the array parameter located where copying begins.
Remarks
The elements are copied to the Array object in the same order that the enumerator iterates through the ContextNodeCollection.
An exception is thrown in the following cases:
The array parameter is a nulla null reference (Nothing in Visual Basic) reference.
The index parameter is less than zero.
The array parameter is multidimensional.
The index parameter is equal to or greater than the length of the array parameter.
The number of elements in the collection is larger than the available space from the index parameter to the end of the destination array parameter.
The type of the collection is cast automatically to the type of the destination array parameter. However, this method copies elements only to arrays of the same type as the elements of the collection, or to arrays of type Object. Attempting to copy to another type of array causes an InvalidCastException exception to be thrown.
Examples
The following example fills one part of an array of ContextNode objects with paragraphs that an InkAnalyzer named theInkAnalyzer, can find. The array starts at index 1 (the second element in a zero-based array) of the destination array, paragraphArray, and leaves the first element of the destination array (with an index of 0) empty.
Dim paragraphs As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph)
Dim paragraphArray(paragraphs.Count + 1) As ContextNode
paragraphs.CopyTo(paragraphArray, 1)
ContextNodeCollection paragraphs =
theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph);
ContextNode[] paragraphArray = new ContextNode[paragraphs.Count + 1];
paragraphs.CopyTo(paragraphArray, 1);
Platforms
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0