The two classes we briefly encountered in the previous examples are subclasses of the
TextWriter classes. Using object-oriented programming at its best, these base classes offer virtual methods for a series of operations that can be applied in more than just the context of file I/O. In fact, on our much beloved
Console class, you can find static properties called
Out that expose a
TextReader and a
string line = Console.In.ReadLine();Console.Out.WriteLine(line);
Console directly offers access to those common operations by providing shortcut methods on the class itself, but in reality a pair of reader and writer objects provides access to the Win32 console. ...