Console.OpenStandardOutput Method is used to get the standard output stream. There are two overloads of OpenStandardOutput method available in C# which are listed below:
- OpenStandardOutput() Method
- OpenStandardOutput(int32) Method
OpenStandardOutput() Method
It is used to get the standard output stream.
Syntax: public static System.IO.Stream OpenStandardOutput ();
Parameters: This method does not accepts any parameter.
Return value: This method returns the standard output stream.
Example:
Output:
Geeksforgeeks
OpenStandardOutput(Int32) Method
It is used to get the standard output stream, which is set to a specified buffer size.
Syntax:public static System.IO.Stream OpenStandardOutput (int bufferSize);
Parameters: This method accepts the following parameter.
- bufferSize: This parameter is the internal stream buffer size.
Return value: This method returns the standard output stream.
Exception: This method will give ArgumentOutOfRangeException if the buffersize is less than or equal to zero.
Example: It replaces 2 consecutive space characters in a string with a tab character.