Поделиться через


ContextNodeCollection.CopyTo - метод

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)

Синтаксис

'Декларация
Public Sub CopyTo ( _
    array As ContextNode(), _
    index As Integer _
)
'Применение
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 void CopyTo(
    ContextNode[] array,
    int index
)
public function CopyTo(
    array : ContextNode[], 
    index : int
)

Параметры

  • array
    Тип: array<Microsoft.Ink.ContextNode[]
    The one-dimensional array that is the destination for elements copied from the collection. The array must have zero-based indexing.
  • index
    Тип: System.Int32
    The zero-based index in the array parameter at which copying begins.

Заметки

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 nullссылка null (Nothing в 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.

This method is synchronized.

Примеры

The following example fills part of an array of ContextNode objects with the all of the paragraphs that an InkAnalyzer, theInkAnalyzer, can find. It starts at element 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(Microsoft.Ink.ContextNodeType.Paragraph)
Dim paragraphArray(paragraphs.Count) As ContextNode
paragraphs.CopyTo(paragraphArray, 1)
            ContextNodeCollection paragraphs =
                theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Paragraph);
            ContextNode[] paragraphArray = new ContextNode[paragraphs.Count + 1];
            paragraphs.CopyTo(paragraphArray, 1);

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

ContextNodeCollection Класс

ContextNodeCollection - члены

Microsoft.Ink - пространство имен