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
Thinker2y ago
Can you show the Keybindings class?
MODiX
MODiX2y 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
Thinker2y 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
Thinker2y 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
Thinker2y ago
I think you should do Console.ReadKey().Key.ToString() That returns the name of the key as a string
MODiX
MODiX2y 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
Thinker2y 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
More Posts
Asp.Net Core Localization Resource File Naming SchemeHi! Im following this tutorial (https://www.codemag.com/Article/2009081/A-Deep-Dive-into-ASP.NET-CorWpf won't compile because SomeClass do not exist in SomeNamespace (but it actually exist!) (solved)I have Wpf app that don't want to compile after adding Window.DataContext tag pointing to viewmodel double array yields only zeroes``` static void RunExerciseSixteen() { int[] ints = new int[10]; RanWhat does 'Intellisense' refer to?Is intellisense solely responsible for all feedback that you receive in the IDE? Or do other parts oCloud Blazor web app - Mitigate malicious crawlers from wasting container resourcesI have a cloud-related question. If I'm hosting a Blazor server web app and I want to prevent maliciSystem.AccessViolationExceptionI'm trying to create a simple multiplayer game using SignalR and Raylib, I wrote a really simple demHow can i achieve something like this```cs public class Test { public string Name{get;set;} } //And i want to do Test.Add(new string SShould I use && and || operators at the end of a line or beginning? [Answered]if (a || b || c) { } vs. if (a || b || c) { } Which is the more accepted standard? I jusConfused about interface default implementations [Answered]Trying out default implementations for methods in the interfaces for the first time. In the interfacAnyone have experience or know of an open source barcode reading library for images?There's of course a bunch of paid options, but I'm looking for an open source alternative if one exi