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

CsharpServer Side ProgrammingProgramming

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
raja
Published on 11-Dec-2019 06:23:22
Advertisements