Example

using System;
using System.IO;

namespace Samples
{
  public class StringReaderSample
  {
    public static void Main()    {
      string s = "damien\nmark\nbrad\n";
      using(StringReader sr = new StringReader(s))
      {
        Console.WriteLine(sr.ReadLine());
        Console.WriteLine((Char)sr.Peek());
        Console.WriteLine((Char)sr.Read());
        Console.WriteLine(sr.ReadToEnd());
      }
    }
  }
}
The output is
damien
m
m
ark
brad

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.