PERSONA PERSONA - 8 days ago 7
C# Question

Prevent the console from overwrting a line

Is there a way for me to stop the console from printing to the top line?
So :


this line in the console doesn't change

but this one and the ones under it can


Any help would be greatly appreciated. Thanks.

Answer

I think if you want leave the first line alone without overwrite it, you can use Console.SetCursorPosition.

Example

// Set cursor starting from the second line
Console.SetCursorPosition(0, 1);
Console.WriteLine("The second line");
Comments