How to change the CursorTop of the Console in C#?

CsharpServer Side ProgrammingProgramming

To change the CursorTop of the Console in C#, use the Console.CursorTop property

Example

Let us now see an example −

using System;
class Demo {
   public static void Main (string[] args) {
      Console.BackgroundColor = ConsoleColor.Blue;
      Console.WriteLine("Background color changed = "+Console.BackgroundColor);
      Console.ForegroundColor = ConsoleColor.Yellow;
      Console.WriteLine("\nForeground color changed = "+Console.ForegroundColor);
      Console.CursorTop = 20;
      Console.WriteLine("\nCursorTop = "+Console.CursorTop);
   }
}

Output

This will produce the following output −

raja
Published on 14-Nov-2019 10:51:33
Advertisements