Console.OpenStandardOutput() Method in C# with Examples Last Updated : 22 Jun, 2020 Comments Improve Suggest changes Like Article Like Report 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: csharp // C# program to illustrate the // Console.OpenStandardOutput() // method using System; class GFG { static void Main(string[] args) { // use of Console.OpenStandardOutput() method // to print the Geeksforgeeks // BeginWrite returns an IAsyncResult that represents // the asynchronous write // int32 value like 071, 101 represents the // ascii value of Geeksforgeeks if (System.Console.OpenStandardOutput().BeginWrite(new byte[] { 071, 101,101, 107,115, 102, 111, 114, 103, 101,101, 107,115, 0 },0, 13, null, null).AsyncWaitHandle.WaitOne()) { } } } 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. csharp // C# program to illustrate the // Console.OpenStandardOutput(int32) method using System; using System.IO; public class GFG { // size of tab private const int Val1 = 2; // working string private const string Val_Text = "Geeks for Geeks"; // main function public static int Main(string[] args) { // check for the argument if (args.Length < 2) { Console.WriteLine(Val_Text); return 1; } try { // replacing space characters in a string with // a tab character using (var wrt1 = new StreamWriter(args[1])) { using (var rdr1 = new StreamReader(args[0])) { Console.SetOut(wrt1); Console.SetIn(rdr1); string line; while ((line = Console.ReadLine()) != null) { string newLine = line.Replace(("").PadRight(Val1, ' '), "\t"); Console.WriteLine(newLine); } } } } catch(IOException e) { TextWriter errwrt = Console.Error; errwrt.WriteLine(e.Message); return 1; } // use of OpenStandardOutput() method var standardOutput = new StreamWriter(Console.OpenStandardOutput()); standardOutput.AutoFlush = true; // set the output Console.SetOut(standardOutput); Console.WriteLine("OpenStandardOutput Example"); return 0; } } Output: Geeks for Geeks Comment More infoAdvertise with us Next Article Console.OpenStandardOutput() Method in C# with Examples S SHUBHAMSINGH10 Follow Improve Article Tags : C# CSharp-Console-Class Similar Reads Console.OpenStandardInput Method in C# Console.OpenStandardInput Method is used to get the standard input stream. There are two overloads of OpenStandardInput method available in C# which are listed below: OpenStandardInput() Method OpenStandardInput(int32) Method OpenStandardInput() Method It is used to get the standard input stream. Ma 2 min read Console.OpenStandardError Method in C# This method is used to acquire a standard error stream. This method can be used to reacquire the standard error stream after it has been changed by the SetError method. Syntax: public static System.IO.Stream OpenStandardError (); Returns: This method returns the standard error stream. Example: The b 2 min read File.OpenText() Method in C# with Examples File.OpenText(String) is an inbuilt File class method which is used to open an existing UTF-8 encoded text file for reading.Syntax:  public static System.IO.StreamReader OpenText (string path); Parameter: This function accepts a parameter which is illustrated below:  path: This is the specified te 2 min read File.OpenRead() Method in C# with Examples File.OpenRead(String) is an inbuilt File class method which is used to open an existing file for reading.Syntax:  public static System.IO.FileStream OpenRead (string path); Parameter: This function accepts a parameter which is illustrated below:  path: This is the specified file which is going to 2 min read File.OpenWrite() Method in C# with Examples File.OpenWrite(String) is an inbuilt File class method that is used to open an existing file or creates a new file for writing. Syntax: public static System.IO.FileStream OpenWrite (string path); Parameter: This function accepts a parameter which is illustrated below: path: This is the specified t 3 min read File.Create(String) Method in C# with Examples File.Create(String) is an inbuilt File class method which is used to overwrites an existing file else create a new file if the specified file is not existing. Syntax: public static System.IO.FileStream Create (string path); Parameter: This function accepts a parameter which is illustrated below: 3 min read File.ReadAllText(String, Encoding) Method in C# with Examples File.ReadAllText(String, Encoding) is an inbuilt File class method that is used to open a text file then reads all the text in the file with the specified encoding and then closes the file.Syntax:  public static string ReadAllText (string path, System.Text.Encoding encoding); Parameter: This functi 2 min read File.ReadAllBytes() Method in C# with Examples File.ReadAllBytes(String) is an inbuilt File class method that is used to open a specified or created binary file and then reads the contents of the file into a byte array and then closes the file.Syntax:  public static byte[] ReadAllBytes (string path); Parameter: This function accepts a parameter 2 min read File.Copy(String, String) Method in C# with Examples File.Copy(String, String) is an inbuilt File class method that is used to copy the content of the existing source file content to another destination file which is created by this function. Syntax:  public static void Copy (string sourceFileName, string destFileName); Parameter: This function acce 3 min read File.ReadLines(String, Encoding) Method in C# with Examples File.ReadLines(String, Encoding) is an inbuilt File class method that is used to read the lines of a file that has a specified encoding. Syntax: public static System.Collections.Generic.IEnumerable ReadLines (string path, System.Text.Encoding encoding); Parameter: This function accepts two parameter 2 min read Like