ArrayList.CopyTo Метод

Определение

Копирует список ArrayList или его часть в одномерный массив.

Перегрузки

CopyTo(Array)

Копирует весь список ArrayList в совместимый одномерный массив Array, начиная с начального элемента целевого массива.

CopyTo(Array, Int32)

Копирует целый массив ArrayList в совместимый одномерный массив Array, начиная с заданного индекса целевого массива.

CopyTo(Int32, Array, Int32, Int32)

Копирует диапазон элементов из списка ArrayList в совместимый одномерный массив Array, начиная с указанного индекса целевого массива.

CopyTo(Array)

Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs

Копирует весь список ArrayList в совместимый одномерный массив Array, начиная с начального элемента целевого массива.

public:
 virtual void CopyTo(Array ^ array);
public virtual void CopyTo (Array array);
abstract member CopyTo : Array -> unit
override this.CopyTo : Array -> unit
Public Overridable Sub CopyTo (array As Array)

Параметры

array
Array

Одномерный массив Array, в который копируются элементы из интерфейса ArrayList. Массив Array должен иметь индексацию, начинающуюся с нуля.

Исключения

array имеет значение null.

Массив array является многомерным.

-или-

Число элементов в исходном массиве ArrayList больше числа элементов, которые может содержать массив назначения array.

Тип исходного массива ArrayList не может быть автоматически приведен к типу массива назначения array.

Примеры

В следующем примере кода показано, как скопировать в ArrayList одномерный System.Arrayобъект .

using namespace System;
using namespace System::Collections;
void PrintValues( array<String^>^myArr, char mySeparator );
int main()
{
   
   // Creates and initializes the source ArrayList.
   ArrayList^ mySourceList = gcnew ArrayList;
   mySourceList->Add( "three" );
   mySourceList->Add( "napping" );
   mySourceList->Add( "cats" );
   mySourceList->Add( "in" );
   mySourceList->Add( "the" );
   mySourceList->Add( "barn" );
   
   // Creates and initializes the one-dimensional target Array.
   array<String^>^myTargetArray = gcnew array<String^>(15);
   myTargetArray[ 0 ] = "The";
   myTargetArray[ 1 ] = "quick";
   myTargetArray[ 2 ] = "brown";
   myTargetArray[ 3 ] = "fox";
   myTargetArray[ 4 ] = "jumps";
   myTargetArray[ 5 ] = "over";
   myTargetArray[ 6 ] = "the";
   myTargetArray[ 7 ] = "lazy";
   myTargetArray[ 8 ] = "dog";
   
   // Displays the values of the target Array.
   Console::WriteLine( "The target Array contains the following (before and after copying):" );
   PrintValues( myTargetArray, ' ' );
   
   // Copies the second element from the source ArrayList to the target ArrayList starting at index 7.
   mySourceList->CopyTo( 1, myTargetArray, 7, 1 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target ArrayList starting at index 6.
   mySourceList->CopyTo( myTargetArray, 6 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target ArrayList starting at index 0.
   mySourceList->CopyTo( myTargetArray );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
}

void PrintValues( array<String^>^myArr, char mySeparator )
{
   for ( int i = 0; i < myArr->Length; i++ )
      Console::Write( "{0}{1}", mySeparator, myArr[ i ] );
   Console::WriteLine();
}

/* 
 This code produces the following output.
 
 The target Array contains the following (before and after copying):
  The quick brown fox jumps over the lazy dog
  The quick brown fox jumps over the napping dog
  The quick brown fox jumps over three napping cats in the barn
  three napping cats in the barn three napping cats in the barn
 */
using System;
using System.Collections;
public class SamplesArrayList  {

   public static void Main()  {

      // Creates and initializes the source ArrayList.
      ArrayList mySourceList = new ArrayList();
      mySourceList.Add( "three" );
      mySourceList.Add( "napping" );
      mySourceList.Add( "cats" );
      mySourceList.Add( "in" );
      mySourceList.Add( "the" );
      mySourceList.Add( "barn" );

      // Creates and initializes the one-dimensional target Array.
      String[] myTargetArray = new String[15];
      myTargetArray[0] = "The";
      myTargetArray[1] = "quick";
      myTargetArray[2] = "brown";
      myTargetArray[3] = "fox";
      myTargetArray[4] = "jumps";
      myTargetArray[5] = "over";
      myTargetArray[6] = "the";
      myTargetArray[7] = "lazy";
      myTargetArray[8] = "dog";

      // Displays the values of the target Array.
      Console.WriteLine( "The target Array contains the following (before and after copying):" );
      PrintValues( myTargetArray, ' ' );

      // Copies the second element from the source ArrayList to the target Array starting at index 7.
      mySourceList.CopyTo( 1, myTargetArray, 7, 1 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array starting at index 6.
      mySourceList.CopyTo( myTargetArray, 6 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array starting at index 0.
      mySourceList.CopyTo( myTargetArray );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );
   }

   public static void PrintValues( String[] myArr, char mySeparator )  {
      for ( int i = 0; i < myArr.Length; i++ )
         Console.Write( "{0}{1}", mySeparator, myArr[i] );
      Console.WriteLine();
   }
}


/*
This code produces the following output.

The target Array contains the following (before and after copying):
 The quick brown fox jumps over the lazy dog
 The quick brown fox jumps over the napping dog
 The quick brown fox jumps over three napping cats in the barn
 three napping cats in the barn three napping cats in the barn
*/
Imports System.Collections

Public Class SamplesArrayList    
    
    Public Shared Sub Main()
        
        ' Creates and initializes the source ArrayList.
        Dim mySourceList As New ArrayList()
        mySourceList.Add("three")
        mySourceList.Add("napping")
        mySourceList.Add("cats")
        mySourceList.Add("in")
        mySourceList.Add("the")
        mySourceList.Add("barn")
        
        ' Creates and initializes the one-dimensional target Array.
        Dim myTargetArray(14) As String
        myTargetArray(0) = "The"
        myTargetArray(1) = "quick"
        myTargetArray(2) = "brown"
        myTargetArray(3) = "fox"
        myTargetArray(4) = "jumps"
        myTargetArray(5) = "over"
        myTargetArray(6) = "the"
        myTargetArray(7) = "lazy"
        myTargetArray(8) = "dog"
        
        ' Displays the values of the target Array.
        Console.WriteLine("The target Array contains the following " _
           + "(before and after copying):")
        PrintValues(myTargetArray, " "c)
        
        ' Copies the second element from the source ArrayList to the target
        ' Array starting at index 7.
        mySourceList.CopyTo(1, myTargetArray, 7, 1)
        
        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)
        
        ' Copies the entire source ArrayList to the target Array starting
        ' at index 6.
        mySourceList.CopyTo(myTargetArray, 6)
        
        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)
        
        ' Copies the entire source ArrayList to the target Array starting
        ' at index 0.
        mySourceList.CopyTo(myTargetArray)
        
        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)
    End Sub    
    
    Public Shared Sub PrintValues(myArr() As String, mySeparator As Char)
        Dim i As Integer
        For i = 0 To myArr.Length - 1
            Console.Write("{0}{1}", mySeparator, myArr(i))
        Next i
        Console.WriteLine()
    End Sub
    
End Class


' This code produces the following output.
' 
' The target Array contains the following (before and after copying):
'  The quick brown fox jumps over the lazy dog      
'  The quick brown fox jumps over the napping dog      
'  The quick brown fox jumps over three napping cats in the barn   
'  three napping cats in the barn three napping cats in the barn

Комментарии

Указанный массив должен иметь совместимый тип.

Этот метод использует Array.Copy для копирования элементов.

Элементы копируются в в Array том же порядке, в котором перечислитель выполняет итерацию по ArrayList.

Этот метод является операциейO(n), где n — .Count

Применяется к

CopyTo(Array, Int32)

Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs

Копирует целый массив ArrayList в совместимый одномерный массив Array, начиная с заданного индекса целевого массива.

public:
 virtual void CopyTo(Array ^ array, int arrayIndex);
public virtual void CopyTo (Array array, int arrayIndex);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit
Public Overridable Sub CopyTo (array As Array, arrayIndex As Integer)

Параметры

array
Array

Одномерный массив Array, в который копируются элементы из интерфейса ArrayList. Массив Array должен иметь индексацию, начинающуюся с нуля.

arrayIndex
Int32

Отсчитываемый от нуля индекс в массиве array, указывающий начало копирования.

Реализации

Исключения

array имеет значение null.

Значение параметра arrayIndex меньше нуля.

Массив array является многомерным.

-или-

Число элементов в исходной коллекции ArrayList больше доступного места от положения, заданного значением параметра arrayIndex, до конца массива назначения array.

Тип исходного массива ArrayList не может быть автоматически приведен к типу массива назначения array.

Примеры

В следующем примере кода показано, как скопировать в ArrayList одномерный System.Arrayобъект .

using namespace System;
using namespace System::Collections;
void PrintValues( array<String^>^myArr, char mySeparator );
int main()
{
   
   // Creates and initializes the source ArrayList.
   ArrayList^ mySourceList = gcnew ArrayList;
   mySourceList->Add( "three" );
   mySourceList->Add( "napping" );
   mySourceList->Add( "cats" );
   mySourceList->Add( "in" );
   mySourceList->Add( "the" );
   mySourceList->Add( "barn" );
   
   // Creates and initializes the one-dimensional target Array.
   array<String^>^myTargetArray = gcnew array<String^>(15);
   myTargetArray[ 0 ] = "The";
   myTargetArray[ 1 ] = "quick";
   myTargetArray[ 2 ] = "brown";
   myTargetArray[ 3 ] = "fox";
   myTargetArray[ 4 ] = "jumps";
   myTargetArray[ 5 ] = "over";
   myTargetArray[ 6 ] = "the";
   myTargetArray[ 7 ] = "lazy";
   myTargetArray[ 8 ] = "dog";
   
   // Displays the values of the target Array.
   Console::WriteLine( "The target Array contains the following (before and after copying):" );
   PrintValues( myTargetArray, ' ' );
   
   // Copies the second element from the source ArrayList to the target Array, starting at index 7.
   mySourceList->CopyTo( 1, myTargetArray, 7, 1 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target Array, starting at index 6.
   mySourceList->CopyTo( myTargetArray, 6 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target Array, starting at index 0.
   mySourceList->CopyTo( myTargetArray );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
}

void PrintValues( array<String^>^myArr, char mySeparator )
{
   for ( int i = 0; i < myArr->Length; i++ )
      Console::Write( "{0}{1}", mySeparator, myArr[ i ] );
   Console::WriteLine();
}

/* 
 This code produces the following output.
 
 The target Array contains the following (before and after copying):
  The quick brown fox jumps over the lazy dog
  The quick brown fox jumps over the napping dog
  The quick brown fox jumps over three napping cats in the barn
  three napping cats in the barn three napping cats in the barn

 */
using System;
using System.Collections;
public class SamplesArrayList1  {

   public static void Main()  {

      // Creates and initializes the source ArrayList.
      ArrayList mySourceList = new ArrayList();
      mySourceList.Add( "three" );
      mySourceList.Add( "napping" );
      mySourceList.Add( "cats" );
      mySourceList.Add( "in" );
      mySourceList.Add( "the" );
      mySourceList.Add( "barn" );

      // Creates and initializes the one-dimensional target Array.
      String[] myTargetArray = new String[15];
      myTargetArray[0] = "The";
      myTargetArray[1] = "quick";
      myTargetArray[2] = "brown";
      myTargetArray[3] = "fox";
      myTargetArray[4] = "jumps";
      myTargetArray[5] = "over";
      myTargetArray[6] = "the";
      myTargetArray[7] = "lazy";
      myTargetArray[8] = "dog";

      // Displays the values of the target Array.
      Console.WriteLine( "The target Array contains the following (before and after copying):" );
      PrintValues( myTargetArray, ' ' );

      // Copies the second element from the source ArrayList to the target Array, starting at index 7.
      mySourceList.CopyTo( 1, myTargetArray, 7, 1 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array, starting at index 6.
      mySourceList.CopyTo( myTargetArray, 6 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array, starting at index 0.
      mySourceList.CopyTo( myTargetArray );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );
   }

   public static void PrintValues( String[] myArr, char mySeparator )  {
      for ( int i = 0; i < myArr.Length; i++ )
         Console.Write( "{0}{1}", mySeparator, myArr[i] );
      Console.WriteLine();
   }
}


/*
This code produces the following output.

The target Array contains the following (before and after copying):
 The quick brown fox jumps over the lazy dog
 The quick brown fox jumps over the napping dog
 The quick brown fox jumps over three napping cats in the barn
 three napping cats in the barn three napping cats in the barn

*/
Imports System.Collections

Public Class SamplesArrayList

    Public Shared Sub Main()

        ' Creates and initializes the source ArrayList.
        Dim mySourceList As New ArrayList()
        mySourceList.Add("three")
        mySourceList.Add("napping")
        mySourceList.Add("cats")
        mySourceList.Add("in")
        mySourceList.Add("the")
        mySourceList.Add("barn")

        ' Creates and initializes the one-dimensional target Array.
        Dim myTargetArray(14) As String
        myTargetArray(0) = "The"
        myTargetArray(1) = "quick"
        myTargetArray(2) = "brown"
        myTargetArray(3) = "fox"
        myTargetArray(4) = "jumps"
        myTargetArray(5) = "over"
        myTargetArray(6) = "the"
        myTargetArray(7) = "lazy"
        myTargetArray(8) = "dog"

        ' Displays the values of the target Array.
        Console.WriteLine("The target Array contains the following (before and after copying):")
        PrintValues(myTargetArray, " "c)

        ' Copies the second element from the source ArrayList to the target Array, starting at index 7.
        mySourceList.CopyTo(1, myTargetArray, 7, 1)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

        ' Copies the entire source ArrayList to the target Array, starting at index 6.
        mySourceList.CopyTo(myTargetArray, 6)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

        ' Copies the entire source ArrayList to the target Array, starting at index 0.
        mySourceList.CopyTo(myTargetArray)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

    End Sub

    Public Shared Sub PrintValues(myArr() As String, mySeparator As Char)
        Dim i As Integer
        For i = 0 To myArr.Length - 1
            Console.Write("{0}{1}", mySeparator, myArr(i))
        Next i
        Console.WriteLine()
    End Sub

End Class


' This code produces the following output.
' 
' The target Array contains the following (before and after copying):
'  The quick brown fox jumps over the lazy dog
'  The quick brown fox jumps over the napping dog
'  The quick brown fox jumps over three napping cats in the barn
'  three napping cats in the barn three napping cats in the barn

Комментарии

Указанный массив должен иметь совместимый тип.

Этот метод использует Array.Copy для копирования элементов.

Элементы копируются в в Array том же порядке, в котором перечислитель выполняет итерацию по ArrayList.

Этот метод является операциейO(n), где n — .Count

Применяется к

CopyTo(Int32, Array, Int32, Int32)

Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs
Исходный код:
ArrayList.cs

Копирует диапазон элементов из списка ArrayList в совместимый одномерный массив Array, начиная с указанного индекса целевого массива.

public:
 virtual void CopyTo(int index, Array ^ array, int arrayIndex, int count);
public virtual void CopyTo (int index, Array array, int arrayIndex, int count);
abstract member CopyTo : int * Array * int * int -> unit
override this.CopyTo : int * Array * int * int -> unit
Public Overridable Sub CopyTo (index As Integer, array As Array, arrayIndex As Integer, count As Integer)

Параметры

index
Int32

Отсчитываемый от нуля индекс исходного списка ArrayList, с которого начинается копирование.

array
Array

Одномерный массив Array, в который копируются элементы из интерфейса ArrayList. Массив Array должен иметь индексацию, начинающуюся с нуля.

arrayIndex
Int32

Отсчитываемый от нуля индекс в массиве array, указывающий начало копирования.

count
Int32

Число элементов для копирования.

Исключения

array имеет значение null.

Значение параметра index меньше нуля.

-или-

Значение параметра arrayIndex меньше нуля.

-или-

Значение параметра count меньше нуля.

Массив array является многомерным.

-или-

Значение параметра index больше или равно значению Count исходного списка ArrayList.

-или-

Число элементов от index до конца исходного списка ArrayList больше доступного места от положения, заданного значением параметра arrayIndex, до конца массива назначения array.

Тип исходного массива ArrayList не может быть автоматически приведен к типу массива назначения array.

Примеры

В следующем примере кода показано, как скопировать в ArrayList одномерный System.Arrayобъект .

using namespace System;
using namespace System::Collections;
void PrintValues( array<String^>^myArr, char mySeparator );
int main()
{
   
   // Creates and initializes the source ArrayList.
   ArrayList^ mySourceList = gcnew ArrayList;
   mySourceList->Add( "three" );
   mySourceList->Add( "napping" );
   mySourceList->Add( "cats" );
   mySourceList->Add( "in" );
   mySourceList->Add( "the" );
   mySourceList->Add( "barn" );
   
   // Creates and initializes the one-dimensional target Array.
   array<String^>^myTargetArray = gcnew array<String^>(15);
   myTargetArray[ 0 ] = "The";
   myTargetArray[ 1 ] = "quick";
   myTargetArray[ 2 ] = "brown";
   myTargetArray[ 3 ] = "fox";
   myTargetArray[ 4 ] = "jumps";
   myTargetArray[ 5 ] = "over";
   myTargetArray[ 6 ] = "the";
   myTargetArray[ 7 ] = "lazy";
   myTargetArray[ 8 ] = "dog";
   
   // Displays the values of the target Array.
   Console::WriteLine( "The target Array contains the following (before and after copying):" );
   PrintValues( myTargetArray, ' ' );
   
   // Copies the second element from the source ArrayList to the target Array, starting at index 7.
   mySourceList->CopyTo( 1, myTargetArray, 7, 1 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target Array, starting at index 6.
   mySourceList->CopyTo( myTargetArray, 6 );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
   
   // Copies the entire source ArrayList to the target Array, starting at index 0.
   mySourceList->CopyTo( myTargetArray );
   
   // Displays the values of the target Array.
   PrintValues( myTargetArray, ' ' );
}

void PrintValues( array<String^>^myArr, char mySeparator )
{
   for ( int i = 0; i < myArr->Length; i++ )
      Console::Write( "{0}{1}", mySeparator, myArr[ i ] );
   Console::WriteLine();
}

/* 
 This code produces the following output.
 
 The target Array contains the following (before and after copying):
  The quick brown fox jumps over the lazy dog
  The quick brown fox jumps over the napping dog
  The quick brown fox jumps over three napping cats in the barn
  three napping cats in the barn three napping cats in the barn

 */
using System;
using System.Collections;
public class SamplesArrayList1  {

   public static void Main()  {

      // Creates and initializes the source ArrayList.
      ArrayList mySourceList = new ArrayList();
      mySourceList.Add( "three" );
      mySourceList.Add( "napping" );
      mySourceList.Add( "cats" );
      mySourceList.Add( "in" );
      mySourceList.Add( "the" );
      mySourceList.Add( "barn" );

      // Creates and initializes the one-dimensional target Array.
      String[] myTargetArray = new String[15];
      myTargetArray[0] = "The";
      myTargetArray[1] = "quick";
      myTargetArray[2] = "brown";
      myTargetArray[3] = "fox";
      myTargetArray[4] = "jumps";
      myTargetArray[5] = "over";
      myTargetArray[6] = "the";
      myTargetArray[7] = "lazy";
      myTargetArray[8] = "dog";

      // Displays the values of the target Array.
      Console.WriteLine( "The target Array contains the following (before and after copying):" );
      PrintValues( myTargetArray, ' ' );

      // Copies the second element from the source ArrayList to the target Array, starting at index 7.
      mySourceList.CopyTo( 1, myTargetArray, 7, 1 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array, starting at index 6.
      mySourceList.CopyTo( myTargetArray, 6 );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );

      // Copies the entire source ArrayList to the target Array, starting at index 0.
      mySourceList.CopyTo( myTargetArray );

      // Displays the values of the target Array.
      PrintValues( myTargetArray, ' ' );
   }

   public static void PrintValues( String[] myArr, char mySeparator )  {
      for ( int i = 0; i < myArr.Length; i++ )
         Console.Write( "{0}{1}", mySeparator, myArr[i] );
      Console.WriteLine();
   }
}


/*
This code produces the following output.

The target Array contains the following (before and after copying):
 The quick brown fox jumps over the lazy dog
 The quick brown fox jumps over the napping dog
 The quick brown fox jumps over three napping cats in the barn
 three napping cats in the barn three napping cats in the barn

*/
Imports System.Collections

Public Class SamplesArrayList

    Public Shared Sub Main()

        ' Creates and initializes the source ArrayList.
        Dim mySourceList As New ArrayList()
        mySourceList.Add("three")
        mySourceList.Add("napping")
        mySourceList.Add("cats")
        mySourceList.Add("in")
        mySourceList.Add("the")
        mySourceList.Add("barn")

        ' Creates and initializes the one-dimensional target Array.
        Dim myTargetArray(14) As String
        myTargetArray(0) = "The"
        myTargetArray(1) = "quick"
        myTargetArray(2) = "brown"
        myTargetArray(3) = "fox"
        myTargetArray(4) = "jumps"
        myTargetArray(5) = "over"
        myTargetArray(6) = "the"
        myTargetArray(7) = "lazy"
        myTargetArray(8) = "dog"

        ' Displays the values of the target Array.
        Console.WriteLine("The target Array contains the following (before and after copying):")
        PrintValues(myTargetArray, " "c)

        ' Copies the second element from the source ArrayList to the target Array, starting at index 7.
        mySourceList.CopyTo(1, myTargetArray, 7, 1)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

        ' Copies the entire source ArrayList to the target Array, starting at index 6.
        mySourceList.CopyTo(myTargetArray, 6)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

        ' Copies the entire source ArrayList to the target Array, starting at index 0.
        mySourceList.CopyTo(myTargetArray)

        ' Displays the values of the target Array.
        PrintValues(myTargetArray, " "c)

    End Sub

    Public Shared Sub PrintValues(myArr() As String, mySeparator As Char)
        Dim i As Integer
        For i = 0 To myArr.Length - 1
            Console.Write("{0}{1}", mySeparator, myArr(i))
        Next i
        Console.WriteLine()
    End Sub

End Class


' This code produces the following output.
' 
' The target Array contains the following (before and after copying):
'  The quick brown fox jumps over the lazy dog
'  The quick brown fox jumps over the napping dog
'  The quick brown fox jumps over three napping cats in the barn
'  three napping cats in the barn three napping cats in the barn

Комментарии

Указанный массив должен иметь совместимый тип.

Этот метод использует Array.Copy для копирования элементов.

Элементы копируются в в Array том же порядке, в котором перечислитель выполняет итерацию по ArrayList.

Этот метод является операциейO(n), где n — .count

Применяется к