C#’s char
type (aliasing the System.Char
type) represents a Unicode character, and it
occupies two bytes. A char
literal
is specified inside single quotes:
char c = 'A'; // simple character
Escape sequencesexpress characters that cannot be expressed or interpreted literally. An escape sequence is a backslash followed by a character with a special meaning. For example:
char newLine = ' '; char backSlash = '';
The escape sequence characters are outlined below.
Char |
Meaning |
Value |
---|---|---|
' |
Single quote |
|
” |
Double quote |
|
\ |
Backslash |
|
|