Concat byte arrays
//create two byte arrays with the following values
byte [] array1 = new byte [3] { 0, 1, 2 };
byte [] array2 = new byte [3] { 4, 5, 6 };
//create a byte array named concat whose length should be the sum of the above two arrays which has to be concatenated.
byte [] concat = new byte [array1.Length + array2.Length];
//Then, preferably use System.Buffer.BlockCopy to copy the data, since it is
a lot faster than System.Array.Copy:
System.Buffer.BlockCopy(array1, 0, concat, 0, array1.Length);
System.Buffer.BlockCopy(array2, 0, concat, array1.Length, array2.Length);
//The System.Buffer.BlockCopy takes the following arguements
(source array, starting position of the source array, destination array, starting position of the destination array, length of the source array)
//Thus the concat byte array contains the following values {0,1,2,4,5,6} after concatenation.
