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

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

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 −

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