c# – Outputting text to the same part of the console


for practice, I want to write a timer in the console, and I don’t understand yet how to do it so that it doesn’t start on a new line, but change the number itself to a larger one! please tell me which part of the documentation you need to climb, I'm not asking for a ready-made solution!


Into this one: Console.SetCursorPosition .

How to find it: you probably know that the Console class has some methods like Write and WriteLine – well, look next to it in the documentation for what else is there. Or they usually do it even easier: write the Console, put an end to it and see what methods are available in the autocomplete hints.

Alternatively, if you have only this line with a timer on the screen and you can afford to hide everything on the screen and re-write the timer value – there is Console.Clear next to it, you can experiment with it.

Scroll to Top