C# : Converting Stream to String and String to Bytes
Following code can be sued for converting stream to string and then stream to bytes.
Stream Stream1 = bodyPart.GetOriginalDataStream();
String test = new StreamReader(Stream1).ReadToEnd(); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
Byte[] bytes = encoding.GetBytes(test);
Following code can be sued for converting stream to string and then stream to bytes.
Stream Stream1 = bodyPart.GetOriginalDataStream();
String test = new StreamReader(Stream1).ReadToEnd(); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
Byte[] bytes = encoding.GetBytes(test);
Comments
Post a Comment