Next we use Buffer.BlockCopy to merge two int arrays. This method acts upon bytes, not elements (which are four bytes here).
using System;
// ... Two input arrays.
int[] array = { 1, 2, 3 };
int[] array2 = { 4, 5, 6 };
// ... Destination array.
int[] final = new int[array.Length + array2.Length];
// ... Copy first array.
Buffer.BlockCopy(array,
0,
final,
0,
array.Length * sizeof(int));
// ... Copy second.
// Note the starting offset.
Buffer.BlockCopy(array2,
0,
final,
array.Length * sizeof(int),
array2.Length * sizeof(int));
// ... Display.
foreach (int value in final)
{
Console.WriteLine(value);
}
1
2
3
4
5
6