There are several different ways of specifying single character literals in C#. Each character is a 2-byte Unicode character and is of type char.
Here are some examples of character literals:
1
2
3
4
5
6
7
| char c1 = 'A' ; char c2 = '^' ; char c3 = '\'' ; // Escape: single quote char c4 = '\\' ; // Escape: backslash char c5 = '\x45' ; // Hex code for ASCII 'E' char c6 = '\x20AC' ; // Hex code for Euro sign char c7 = '€' ; // Euro sign directly in code |