System.Error is used to display error messages on the console. It also uses the
Write and the WriteLine methods. You might wonder why you would use a separate
stream to display errors if you can display errors using Console.Out. When you
develop applications that use the SetOut method of the Console class to redirect
the output of Console.Out to some other stream, then errors also need to be
redirected to a separate stream. The Console.Error class provides a means of
accomplishing this. Suppose you create an installer application that runs on the
command line. You want the log file to record the success or failure of the
component being installed, so you redirect Console.Out to a stream that writes
to a log file. Thus, the user sees no output on the console. However, some
missing files cause an exception to be thrown and you want to inform the user
about it. You use the Console.Error stream to notify the user of the missing
files on the console screen.
You might also wonder why you need the In and Out classes at all if you don't
need to specify the In or Out during input or output. In and Out allow you to
differentiate between different streams when you use the System.Error class.
Because the Error stream uses the same methods as those of the Output stream,
it's better to use the full name of the Output stream in such cases.