Computer >> Computer tutorials >  >> Programming >> C#

C# Console.WindowHeight Property


The WindowHeight property gets or sets the height of the console window.

Declare a variable.

int height;

Now, get the height of the current window.

height = Console.WindowHeight;

The following is the complete example −

Example

using System;
using System.Numerics;
using System.Globalization;
class Demo {
   static void Main() {
      int height;
      height = Console.WindowHeight;
      Console.WriteLine("Current window height = "+height);
   }
}

Output

Current window height = 0