A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/c-sharp/console-setbuffersize-method-in-c-sharp/ below:

Console.SetBufferSize() Method in C# - GeeksforGeeks

Console.SetBufferSize() Method in C#

Last Updated : 11 Jul, 2025

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: 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:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4