O'Reilly logo

VB.NET Core Classes in a Nutshell by Ted Neward, Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Console

Synopsis

The Console class provides shared methods that allow you to create console, or command-line, applications. If you attempt to use these methods in a Windows Forms application, they are ignored. For a console application, data is transmitted through three streams. Input is received from the standard input stream, output is written through the standard output stream, and error data is written to the standard error output stream. These streams are provided through the In property, which is a System.IO.TextReader object, and through the Out and Error properties, which are System.IO.TextWriter objects. You can use the methods of these objects directly, or you can use the methods provided by the Console class. For example, you can use the Write() method to write any basic data type to the console window (or use WriteLine() to write data with a trailing hard return). You can also use the ReadLine() method to cause the console window to wait for input. When the user presses the Enter key, this method returns with a string containing the input characters (except the final hard return).

You can use the SetIn(), SetOut(), and SetError() methods to bind the console to different stream objects, such as System.IO.FileStream. To reset the streams to their default objects, use the methods prefixed with OpenStandard. . ..

Public NotInheritable Class Console
                  ' Public Shared Properties
   Public Shared ReadOnly Property Error As TextWriter  
   Public Shared ReadOnly Property In As TextReader ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required