C#ArrayArray.Copy

Copies a range of elements from one array to another.

문법

Array.Copy(sourceArray, destArray, length)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

source
dest
new
Copy
Console
WriteLine
string
int[] source = { 1, 2, 3, 4, 5 };
int[] dest = new int[5];
Array.Copy(source, dest, 3);
Console.WriteLine(string.Join(", ", dest));   // 1, 2, 3, 0, 0