Share via


Recognizers.CopyTo Method

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

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

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

instance.CopyTo(array, index)
public void CopyTo (
    Array array,
    int index
)
public:
virtual void CopyTo (
    Array^ array, 
    int index
) sealed
public final void CopyTo (
    Array array, 
    int index
)
public final function CopyTo (
    array : Array, 
    index : int
)
Not applicable.

Parameters

  • array
    The one-dimensional array that is the destination of elements copied from the collection. The array must have zero-based indexing.
  • index
    The zero-based index in the array parameter at which copying begins.

Remarks

The elements are copied to the Array object in the same order in which the enumerator iterates through the Recognizers.

An exception is thrown if:

  • The array parameter is a a null reference (Nothing in Visual Basic) (Nothing in Microsoft® Visual Basic® .NET) 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 higher 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 only copies elements 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 exceptionto be thrown.

This method is synchronized.

Example

This C# example creates a Recognizers collection, theRecognizers, and then copies the collection into the array, theCopy, which is set to the same size as the number of members of theRecognizers.

//Create the Recognizers collection
theRecognizers = new Recognizers();
//Create the array and set the size equal to the size of the Recognizers collection
theCopy = new Recognizer[theRecognizers.Count];
//Copy the Recognizers collection into the array, starting at index of 0
theRecognizers.CopyTo(theCopy,0);

This Visual Basic .NET example creates a Recognizers collection, theRecognizers, and then copies the collection into the array, theCopy, which is set to the same size as the number of members of theRecognizers.

'Create the Recognizers Collection.
Dim theRecognizers As Recognizers
'Create the array and set the size equal to the size of the Recognizers collection.
Dim theCopy(theRecognizers.Count) As Recognizer
'Copy the Recognizers collection into the array, starting at index of 0
theRecognizers.CopyTo(theCopy, 0)

Platforms

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Recognizers Class
Recognizers Members
Microsoft.Ink Namespace