Characters include letters, numbers, punctuation marks, and special characters. The numbers and expressions of characters in different character sets are different. C # uses the Unicode character set. The length of a Unicode standard character is 16 characters.
The character type (char) in C # Corresponds to the structure system. Char in the. NET class library. InProgramEach declared char type variable creates a system. Char
Structure. Strictly speaking, the struct type is also a special Integer type. Its value range is the same as that of the ushort type. The C # compiler is responsible for converting integers and characters within the specified range.
CharX= 'A';
Character type (char): use single quotes;
String type (string): Double quotation marks are used.
C # uses the Unicode character set. A single Chinese character can also be used as a character.
CharY= 'Quantity';
In C #, use the Backslash "\" to guide escape characters.
CharZ= '\'';
Common escape characters in C #
| Escape Character |
character name |
Escape Character |
character name |
Escape Character |
character name |
Escape Character |
character name |
| \' |
Single quotes |
\ F |
Form feed |
\ 0 |
NULL Character |
\ T |
Horizontal Tab |
| \" |
Double quotation marks |
\ N |
Line feed |
\ |
Alert (Bell) |
\ V |
Vertical Tab |
| \\ |
Slash |
\ R |
Enter |
\ B |
Return |
|
|
In C #, use @ to cancel the escape of the backslash.
StringPath= @"F: \ projects \";