Is there a simpler way to convert numbers to their keyboard Shift+[n] equivalent in C# other than using a case statement? Assume the use of a standard English language keyboard.
9=(
8=*
7=&
6=^
5=%
4=$
3=#
2=@
1=!
0=)
I’m not aware of a method built into the language.
As suggeted in the comments, you could make a lookup table, rather than using a
switchstatement. With the initializer syntax, the amount of coding is minimized.