Eric wrote:
Is there a class that will allow me to append a byte[] to another?
The data that I have is binary so StringBuilder will not work.
Others have suggested a MemoryStream. I won't. The reason is that it
will cause at least one extra array allocation than you need. Just
allocate the array yourself and use Buffer.BlockCopy, it is simple:
byte[] AppendArrays(byte[] a; byte[] b)
{
byte[] c = new byte[a.Length + b.Length]; // just one array
allocation
Buffer.BlockCopy(a, 0, c, 0, a.Length);
Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
return c;
}
Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm http://www.grimes.demon.co.uk/workshops/securityWS.htm