data appendBytes:&buffer length:len similar functionality in C#
I am working on a project where two softwares communicates with each other. One of the application is developed using Objective C and the other using C#. Both softwares uses encoding and decoding scheme which is spec开发者_如何转开发ific to this software. The software developed using objective c used [data appendBytes:&buffer length:len]
to append bytes to a buffer of specific length.
I am developing the other half of the software in C#. I am looking for similar functionality [data appendBytes:&buffer length:len]
in C#.
Please can any one suggest how this can be done?
The closest I can think of I/O wise is a memory stream:
byte [] buffer = new byte[10];
//fill buffer
MemoryStream ms = new MemoryStream();
ms.Write(buffer, 0, buffer.Length); //appends bytes to the end of the stream
Depending on where you want your data written (file, memory, network) there are many other Stream derived classes - that would be a good starting point.
精彩评论