Getting the Standard Output and Standard Error Output Stream through Console in C#



To get the standard output stream through Console, the code is as follows −

Example

 Live Demo

using System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Standard Output Stream = "+Console.Out);    } }

Output

This will produce the following output −

Standard Output Stream = System.IO.TextWriter+SyncTextWriter

Example

To get the standard error output stream through Console, the code is as follows −

 Live Demo

using System; public class Demo {    public static void Main(string[] args){       Console.WriteLine("Standard Output Stream = "+Console.Out);       Console.WriteLine("Standard Error Output Stream = "+Console.Error);    } }

Output

This will produce the following output −

Standard Output Stream = System.IO.TextWriter+SyncTextWriter Standard Error Output Stream = System.IO.TextWriter+SyncTextWriter
Updated on: 2019-12-11T06:24:33+05:30

659 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements