How do I convert integers to characters in C#?
- by Mike Webb
I am trying to convert an index of 1 to 27 into the corresponding uppercase letter. I know that in C++ I could type this:
char letter = 'A' + (char)(myIndex % 27);
This same code does not work in C#. How can I accomplish this task in C#?
EDIT: I'd rather not have to encode an enum or switch statement for this if there is a better mathematical solution like the one above.