2007-12-17

Read a Stream into a String in C# .Net

using (MemoryStream ms = new MemoryStream())
{
//
// Write stuff into the memory stream with ms.Write();
//

// Jump to the start position of the stream
ms.Seek(0, SeekOrigin.Begin);

StreamReader rdr = new StreamReader(ms);
string str = rdr.ReadToEnd();
}
Post a Comment