Книга: C# 2008 Programmer

Copying Arrays

Copying Arrays

To copy from one array to another, use the Copy() method from the Array abstract base class:

int[] num = new int[5] { 1, 2, 3, 4, 5 };
int[] num1 = new int[5];
num.CopyTo(num1, 0);

These statements copy all the elements from the num array into the num1 array. The second parameter in the CopyTo() method specifies the index in the array at which the copying begins.

Оглавление книги


Генерация: 1.106. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз