Jump to content

Padre, Where did Lou come up with key press "a " is 65, key press "b " is 66, etc I know it ...


G+_Cosmic Ray
 Share

Recommended Posts

Padre,

Where did Lou come up with key press "a" is 65, key press "b" is 66, etc.

I know it's from Console.ReadKey().Key, but is there a table somewhere that shows all the equivalents to each key press? I tried Googling for it, and also looking on StackOverflow but couldn't find it.

thanks

Link to comment
Share on other sites

Thanks, Neil.

 

Odd that you found that in the Visual Basic section. As the example is for using C#, I would have never thought to look there!

 

Yes, MSDN is a great source, if you know where to look.

 

I notice in the tables you linked to that there's no distinction between capital and lower case letters, which also seems odd.

Link to comment
Share on other sites

Good point. Console.ReadKey() method returns a ConsoleKeyInfo struct and we access Key property which is an enumeration called ConsoleKey (http://msdn.microsoft.com/en-us/library/system.consolekey(v=vs.110).aspx). 

I think the main point is we don't actually get the raw key value and apparently it is implemented to return case-insensitive values.

 

You can check the source code of the Console class and see how ReadKey() is implemented here: http://www.dotnetframework.org/default.aspx/DotNET/DotNET/8@0/untmp/whidbey/REDBITS/ndp/clr/src/BCL/System/Console@cs/2/Console@cs

 

Or you can use a tool like JustDecompile from Telerik (which is free) just to play around and browse through the framework. Sometimes it helps to check out the actual implementation.

Link to comment
Share on other sites

 Share

×
×
  • Create New...