Type Summary

						public class StringReader : TextReader
{
  // Constructors
     public StringReader (string s);

  // Methods
     public override void Close ();
     protected override void Dispose (bool disposing);
     public override int Peek ();
     public override int Read ();
     public override int Read (char[] buffer,
                              int index, int count);
     public override string ReadLine ();
     public override string ReadToEnd ();
}

BG StringReader and StringWriter have been some of the harder classes for people to get their heads around in the IO namespace. They are roughly similar to C++'s strstream. They allow you to read and write to a String using the same API's you'd use to write to any Stream. Hence, the TextReader and TextWriter base classes.

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.