Asp Net Source.com
What's ASP.NET?

AspNetSource.com's BLOG

AJAX, ASP.NET, C#, CSS, Design, .NET Framework, Javascript, SQL, VB.NET, etc.

Concat Byte Arrays in C Sharp

Posted by Tihomir Ivanov on 23 April 2009 10:21
Rating: 1.00

In my work I had to concatenate two byte arrays but,
unfortunately, it seems that there's no elegant way to do
concat of two byte arrays in "C#" :(

I'd offer you a suggestion for doing it,
just copy-paste this simpe function in your project:

public byte[] ConcatByteArrays(byte[] a, int aSize, byte[] b, int bSize)
{
byte[] buff = new byte[aSize + bSize];
for(int i=0; i<aSize; i++)
buff[i] = a[i];
for(int i=0; i<bSize; i++)
buff[i+aSize] = b[i];
return buff;
}

 

 Comments:
 Posted by andrew on 20 May 2010 09:05   Rating: -
http://stackoverflow.com/questions/415291/best-way-to-combine-2-or-more-byte-arrays-in-c
 
Our Sponsors:  Asp.net file upload component  |   Flash file uploader  |  ASP.NET Hosting