The WindowsTop property is used to gets or set the top position of the console window area relative to the screen buffer.
Declare an integer variable to get the top position.
int top;
Now, use the Console.WindowTop property.
top = Console.WindowTop;
Let us see the complete example.
Example
using System;
class Demo {
static void Main() {
int top;
top = Console.WindowTop;
Console.WriteLine("Top position of the Console window = "+top);
}
}Output
Top position of the Console window = 0