This documentation is archived and is not being maintained.

Console.BufferHeight Property

Updated: October 2011

Gets or sets the height of the buffer area.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static int BufferHeight { get; set; }

Property Value

Type: System.Int32
The current height, in rows, of the buffer area.


The value in a set operation is less than or equal to zero.


The value in a set operation is greater than or equal to Int16.MaxValue.


The value in a set operation is less than WindowTop + WindowHeight.


The user does not have permission to perform this action.


An I/O error occurred.

This property defines the number of rows (or lines) stored in the buffer that is accessed by a console mode window. In contrast, the WindowHeight property defines the number of rows that are actually displayed in the console window at any particular time. If the number of rows actually written to the buffer exceeds the number of rows defined by the WindowHeight property, the window can be scrolled vertically so that it displays a contiguous number of rows that are equal to the WindowHeight property and are located anywhere in the buffer.

If a set operation decreases the value of the BufferHeight property, the uppermost lines are removed. For example, if the number of lines is reduced from 300 to 250, lines 0 through 49 are removed, and the existing lines 50 through 299 become lines 0 through 249.

This example demonstrates the BufferHeight and BufferWidth properties. The example reports the dimensions of an operating system window set to a buffer size of 300 rows and 85 columns.

// This example demonstrates the Console.BufferHeight and 
//                               Console.BufferWidth properties.
using System;

class Sample 
    public static void Main() 
    Console.WriteLine("The current buffer height is {0} rows.",
    Console.WriteLine("The current buffer width is {0} columns.",
This example produces the following results:

The current buffer height is 300 rows.
The current buffer width is 85 columns.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.




October 2011

Expanded the Remarks section.

Customer feedback.