#24 – Character Literals
July 11, 2010 1 Comment
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:
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