Share via


ContextNodeBaseCollection.CopyTo Method

Copies all of the elements of the current ContextNodeBaseCollection to the specified one-dimensional array, starting at the specified destination array index.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public Sub CopyTo ( _
    array As ContextNodeBase(), _
    index As Integer _
)
'Usage
Dim instance As ContextNodeBaseCollection 
Dim array As ContextNodeBase()
Dim index As Integer

instance.CopyTo(array, index)
public void CopyTo(
    ContextNodeBase[] array,
    int index
)
public:
void CopyTo(
    array<ContextNodeBase^>^ array, 
    int index
)
public function CopyTo(
    array : ContextNodeBase[], 
    index : int
)

Parameters

  • index
    Type: System.Int32

    The zero-based index in the array parameter where copying begins.

Remarks

The elements are copied to Array in the same order that the enumerator iterates through ContextNodeBaseCollection.

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 arrays of type Object. Attempting to copy to another type of array causes an InvalidCastException to be thrown.

This method is synchronized.

Examples

The following example fills part of an array of ContextNodeBase objects with the all of the paragraphs that an InkAnalyzerBase named theInkAnalyzerBase, can find. It starts at element 1 (the second element in a zero-based array) of the destination array named paragraphArray, and leaves the first element of the destination array (with an index of 0) empty.

Dim paragraphs As ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
Dim paragraphArray(paragraphs.Count) As ContextNodeBase
paragraphs.CopyTo(paragraphArray, 1)
            ContextNodeBaseCollection paragraphs =
                theInkAnalyzer.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
            ContextNodeBase[] paragraphArray = new ContextNodeBase[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

See Also

Reference

ContextNodeBaseCollection Class

ContextNodeBaseCollection Members

System.Windows.Ink.AnalysisCore Namespace