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



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

Example

Let us 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("
Foreground color changed = "+Console.ForegroundColor);       Console.CursorLeft = 30;       Console.Write("CursorLeft position: "+Console.CursorLeft);    } }

Output

This will produce the following output −

Updated on: 2019-11-13T07:00:13+05:30

319 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements