This question already has an answer here:
- How to convert byte[] to string? 4 answers
I created a byte array with two strings. How do I convert a byte array to strings?
var binWriter = new BinaryWriter(new MemoryStream());
binWriter.Write("value1");
binWriter.Write("value2");
binWriter.Seek(0, SeekOrigin.Begin);
byte[] result = reader.ReadBytes((int)binWriter.BaseStream.Length);
I want to convert result
to strings. I can do it using BinaryReader
. But I can not use BinaryReader
(it does not supported).