Console.SetBufferSize() Method in C# Last Updated : 14 Mar, 2019 Comments Improve Suggest changes Like Article Like Report Console.SetBufferSize(Int32, Int32) Method is used to set the height and width of the screen buffer area to the specified values. Syntax: public static void SetBufferSize(int width, int height); Parameters: width: It sets the width of the buffer area measured in the form of columns. height: It sets the height of the buffer area measured in the form of rows. Return value: The new size of the buffer screen. Exceptions: ArgumentOutOfRangeException: If the height or width is less than or equal to zero Or height or width is greater than or equal to MaxValue. Also, if the width is less than WindowLeft + WindowWidth or height is less than WindowTop + WindowHeight then we will get the same exception. IOException: If an I/O error occurred. Note: As you will see via the horizontal and the vertical scrollbars in the below examples, as we give different dimensions, we get differently sized windows. Example 1: csharp // C# program to demonstrate // the SetBufferSize Method using System; using System.Text; using System.IO; class GFG { // Main Method public static void Main() { // using the method Console.SetBufferSize(800, 800); Console.WriteLine("Start"); while (true) { Console.WriteLine("Great Geek's Example!!!"); } } // end Main } Output: Example 2: csharp // C# program to demonstrate // the SetBufferSize Method using System; using System.Text; using System.IO; class GFG { // Main Method public static void Main() { Console.SetBufferSize(0, 80); Console.WriteLine("Great Geek's Example!!!"); Console.WriteLine("The Width's value is too less!"); } // end Main } Example 3: csharp // C# program to demonstrate // the SetBufferSize Method using System; using System.Text; using System.IO; class GFG { // Main Method public static void Main() { Console.SetBufferSize(8000, -80); Console.WriteLine("Great Geek's Example!!!"); Console.WriteLine("The negativity of this height is unbearable!"); } // end Main } Reference: https://docs.microsoft.com/en-us/dotnet/api/system.console.setbuffersize?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article Console.SetBufferSize() Method in C# N NishanthVaidya Follow Improve Article Tags : C# CSharp-method CSharp-Console-Class Similar Reads Console.MoveBufferArea Method in C# Console.MoveBufferArea Method is used to move the specified screen area to destination area. Syntax: public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop); Parameters: sourceLeft: The leftmost column of the source area. so 2 min read Console.SetIn() Method in C# The Console.SetIn() method is used to set the In property of the specified StreamReader object i.e. it redirects the standard input from the console to the input file. Since the console is set with this StreamReader object, the ReadLine() method can be called to read the contents of the file, line b 2 min read Console.SetWindowSize() Method in C# Console.SetWindowSize(Int32, Int32) Method is used to change the height and width of the console window to the specified values. Syntax: public static void SetWindowSize (int width, int height); Parameters: width: The width of the console window measured in columns. height: The height of the console 2 min read Console.SetError() Method in C# The Console.SetError(TextWriter) Method sets the Error property of the specified StreamWriter i.e., it redirects the standard error stream to a file. As the console is set with this StreamWriter object, the WriteLine() method can be called to write the error into the file. Syntax: public static void 2 min read Console.SetOut() Method in C# Console.SetOut(TextWriter) Method in C# is used to redirect the stream of standard output. With the help of this method, a user can specify a StreamWriter as the output object. The Console.SetOut method will receive an object of type TextWriter. The StreamWriter can be passed to Console.SetOut and i 2 min read Like