Example:
using System.Text; ... string str = "Hello, World!!!"; byte[] byteData = Encoding.UTF8.GetBytes(str);
On the opposite way, to convert back from byte array into string, we can simply use StreamReader to read it from MemoryStream.
Example:
Example:
string output = string.Empty; byte[] byteData = ...; using (var memoryStream = new MemoryStream(byteData)) { using (var streamReader = new StreamReader(memoryStream)) { output = streamReader.readToEnd(); } }
No comments:
Post a Comment