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 letter R
is the character representation of the Key
from ConsoleKeyInfo
structure. If you want to read exactly what was written to console use Console.Read()
or Console.ReadLine()
.