首页 > 代码库 > Literal Values

Literal Values

// Literal Values
// TYPE(S)                 CATEGORY    SUFFIX                            EXAMPLE/ALLOWED VALUES
// bool                    boolean     none                              true or false
// int, uint, long, ulong  integer     none                              100
// uint, ulong             integer     u or U                            100U
// long, ulong             integer     l or L                            100L
// ulong                   integer     ul, uL, Ul, UL, lu, lU, Lu, LU    100UL
// float                   real        f or F                            1.5F
// double                  real        none, d, D                        1.5
// decimal                 real        m or M                            1.5M
// char                    character   none                              ‘a‘, or escape sequence
// string                  string      none                              "a…a", may include escape sequences

 

Escape Sequences for String Literals

 

// ESCAPE SEQUENCE CHARACTER PRODUCED      UNICODE VALUE OF CHARACTER
// \‘              Single quotation mark   0x0027
// \"              Double quotation mark   0x0022
// \\              Backslash               0x005C
// \0              Null                    0x0000
// \a              Alert (causes a beep)   0x0007
// \b              Backspace               0x0008
// \f              Form feed               0x000C
// \n              New line                0x000A
// \r              Carriage return         0x000D
// \t              Horizontal tab          0x0009
// \v              Vertical tab            0x000B
//
// -The Unicode Value of Character column of the preceding table shows the hexadecimal values of the
// -characters as they are found in the Unicode character set. As well as the preceding, you can specify any
// -Unicode character using a Unicode escape sequence. These consist of the standard \ character followed by a
// -u and a four-digit hexadecimal value
//
// -the following strings are equivalent:
// "Karli\‘s string."
// "Karli\u0027s string."
//
// -strings are reference types,can be assigned the value null
//
//
// -verbatim string literals
// -the following strings are equivalent:
// "C:\\Temp\\MyDir\\MyFile.doc"
// @"C:\Temp\MyDir\MyFile.doc"

Literal Values