Convert half empty byte array to string?
Latest Revision
Hello Codeproject,
Let's assume I have a byte array as follows:
byte[] MainArray = new byte[4096];
I then make another array out of a string:
byte[] String = Encoding.ASCII.GetBytes("hello world");
I then copy that array to the main array:
Array.Copy(String, 0, MainArray, 0, String.Length);
How would I after transfering this byte array over TCP know that it's Hello World, because when decoding it I have also decoded the rest of the MainArrays empty area.
[Edit]Code block added[/Edit]
Posted 16-Mar-13 5:34am
by
Yvar Birx.