Combine byte[]

  • Thread starter Thread starter TJO
  • Start date Start date
Hi,

Look at Array.Copy() and Array.CopyTo() methods.

What is the best way to combine two byte[]? I am not finding one yet.
Thanks
 
What is the best way to combine two byte[]? I am not finding one yet.

Something like this:

byte[] Combine(byte[] a, byte[] b)
{
byte[] c = new byte[a.Length + b.Length];
System.Buffer.BlockCopy(a, 0, c, 0, a.Length);
System.Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
return c;
}



Mattias
 
Back
Top