Getting the Largest Window Height and Width of the Console in C#


To get the largest window height of the Console, the code is as follows −

Example

 Live Demo

using System;
public class Demo{
   public static void Main(string[] args){
      Console.WriteLine("Largest Window Height of the Console = "+Console.LargestWindowHeight);
   }
}

Output

This will produce the following output −

Largest Window Height of the Console = 58

Example

To get the largest window width of the Console, the code is as follows −

 Live Demo

using System;
public class Demo{
   public static void Main(string[] args){
      Console.WriteLine("Largest Window Width of the Console = "+Console.LargestWindowWidth);
   }
}

Output

This will produce the following output −

Largest Window Width of the Console = 190

Updated on: 11-Dec-2019

169 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements