Can I increase a c# character's value by addition?

For instance, I want to do something like the following:

char output = 'A' + 1;

getting output of 'B'

However, simply trying what I have above gives a casting error.

Jon Skeet
people
quotationmark

Yes, the binary + operator isn't defined on char, so you end up with implicit conversions to int. You can use a pre/post-increment operator:

char x = 'A';
x++;

... because the ++ operator is defined for char.

But otherwise, you need a cast:

char x = 'A';
x = (char) (x + 1);

people

See more on this question at Stackoverflow