I'm concatenating a large number of byte[] arrays in C#. If I were doing this for strings, I would use StringBuilder -- is there an equivalent class that would work for binary data in byte[] arrays?
+15
A:
I don't think there is an exact equivalent, but you could get it done with a BinaryWriter:
http://msdn2.microsoft.com/en-us/library/system.io.binarywriter.aspx
MemoryStream m = new MemoryStream();
BinaryWriter writer = new BinaryWriter(m);
writer.write(true);
writer.write("hello");
writer.write(12345);
writer.Flush();
return m.ToArray();
JerSchneid
2009-05-24 13:39:25
Precisely what I needed, thank you.
kdt
2009-05-24 14:30:11