Console.ReadKey() binds to Consolekeyinfo

Well im just trying to create some keybindings and save them down in a .json file.. everything works out great but somehow no matter what key i press to test it out it binds it to System.ConsoleKeyInfo instead of a real key press
18 Replies
Thinker
Thinker3y ago
Can you show the Keybindings class?
MODiX
MODiX3y ago
thinker227#5176
REPL Result: Success
Console.ReadKey().ToString()
Console.ReadKey().ToString()
Result: string
System.ConsoleKeyInfo
System.ConsoleKeyInfo
Compile: 430.771ms | Execution: 20.343ms | React with ❌ to remove this embed.
Thinker
Thinker3y ago
Ah, a key info doesn't have a ToString override
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
ohh.. so what should i do to fix this 😄
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
or does it not work? 😄
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
switching up string with var works.. but i cant switch string to var in here...
Thinker
Thinker3y ago
Wdym?
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
switching string into var here works..
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
he doesnt say anything then.. but then this not work xD
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
or idk.. im pretty much idealess 😄 need help :3
Thinker
Thinker3y ago
I think you should do Console.ReadKey().Key.ToString() That returns the name of the key as a string
MODiX
MODiX3y ago
thinker227#5176
REPL Result: Success
Console.ReadKey().Key.ToString()
Console.ReadKey().Key.ToString()
Result: string
A
A
Compile: 429.654ms | Execution: 30.809ms | React with ❌ to remove this embed.
Thinker
Thinker3y ago
As opposed to just Console.ReadKey().ToString() which doesn't return anything useful
₮ⱤØ₣Ⱡł₦Ɇ_฿Ⱡ₳₵₭
works :3 tyty 😄
Want results from more Discord servers?
Add your server