Archives

Archives / 2006 / September
  • String Streams in .Net

    I while ago (almost 2 years) I posted a way to create a string stream in .Net. There has been a number of new comments added to that post recently so I figured I needed to update that example. Most API's that look for a Stream will also allow either a TextReader or TextWriter depending on the context. Therefore, in those cases when you have a string using StringReader or StringWriter is probably better then creating a MemoryStream like in my old example because you don't have to deal with the encoding.