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
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