C# Console.WindowWidth Property


The WindowWidth property gets or sets the width of the console window.

Declare a variable.

int width;

Now, get the width of the current window.

width = Console.WindowWidth;

The following is the complete example.

Example

 Live Demo

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

Output

Current window width = 0
Current window height = 0

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 23-Jun-2020

231 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements