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


Tablets.CopyTo - метод

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

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

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

Синтаксис

'Декларация
Public Sub CopyTo ( _
    array As Array, _
    index As Integer _
)
'Применение
Dim instance As Tablets
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
)

Параметры

  • array
    Тип: System.Array
    The one-dimensional array that is the destination of 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.

Реализации

ICollection.CopyTo(Array, Int32)

Заметки

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

An exception is thrown if:

  • The array parameter is a nullссылка null (Nothing в 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 exception to be thrown.

This method is synchronized.

Примеры

This example fills part of an array of Tablet objects with the entire contents of the Tablets collection, starting at element 1 (the second element in a zero-based array) of the destination array allTabletsArray and leaving the first element of the destination array (with an index of 0) empty. Note that just constructing a Tablets collection fills it with the available tablets.

Dim allTablets As New Tablets()
' create an array that has one more element than allTablets
Dim allTabletsArray(allTablets.Count) As Tablet
allTablets.CopyTo(allTabletsArray, 1)
Tablets allTablets = new Tablets();
// create an array that has one more element than allTablets
Tablet[] allTabletsArray = new Tablet[allTablets.Count + 1];
allTablets.CopyTo(allTabletsArray, 1);

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

Tablets Класс

Tablets - члены

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