Check the following code
///Buffer to store the data
byte[] data = new byte[DEFAULT_BUFF_SIZE];
///Create a memory stream from the buffer
MemoryStream memStream = new MemoryStream(data);
///Binary writer
BinaryWriter newData = new BinaryWriter(memStream);
///Write the data
newData.Write(Convert.ToUInt32(nResourceID));
///need to identify available free size in data
///newData.Write(Convert.ToUInt32(nResLength));
/// write(byte[], index, count);
newData.Write(
buffer having data more than DEFAULT_BUFF_SIZE,
anywhere in the memory buff,
should fill up to DEFAULT_BUFF_SIZE);
Now the problem is what is the best possible solution to know how much data
is written in the buffer i.e. "data" variable?
I need to stick to the DEFAULT_BUFF_SIZE limit while writing the data
BinaryWriter gives me more flexibility to write any kind of data?
MemoryStream only accepts the byte kind of data? which is not readily
available.