This snipet Outputs two Letters when i press one Key (r).
string key = string.Empty;
key = Console.ReadKey().Key.ToString();
Console.WriteLine(key);
Console.ReadKey();
// Output: rR
Why does it output lower 'r' and Upercase 'R' when i only press once the lowercase 'r'?
The lower case
r
is what you have written from keyboard. You do not remove it form console by reading it. And the capital letterR
is the character representation of theKey
fromConsoleKeyInfo
structure. If you want to read exactly what was written to console useConsole.Read()
orConsole.ReadLine()
.