How can I use the Up/Down arrow keys in a C# Dotnet console application without displaying any text?

Viewed 24

So, I've got this code that changes the cursor position:

var cursorPOS = Console.GetCursorPosition();

var keyInput = Console.ReadKey(true).Key;
if(keyInput == ConsoleKey.UpArrow) {
   Console.SetCursorPosition(0,0);
}

It works just fine until I enter some text. Then when I use the arrow keys it just fills that line with the previously entered text. Is there any way to still be able to get the input of the arrow keys but disable the text that comes with it? I can't find any details about it online and really don't even know what to search to try and figure it out. Any Help is appreciated!

0 Answers
Related