I'm using Console.ReadLine
to read the input of the user. However, I want to hide/exclude the inputted text on the console screen while typing. For example, when the user writes "a", it writes "a" to the console and then I will have a variable with the value "a". However, I don't want "a" to be written on the console's output.
How can I do that?
I just changed the foreground colour to black while the password was being inputted. I a newbie so it's probably a bad idea but it worked for the challenge i was trying
I created this method from the code in the answer by dataCore and the suggestion by m4tt1mus. I also added support for the backspace key.
Here is a short implementation. thx @ojblass for the idea
Console.ReadKey(true) hides the user key. I do not believe Console.Read() offers such a capability. If necessary you can sit in a loop reading keys one at a time until enter is pressed. See this link for an example.