3.5.The string Type

A string is a sequence of text characters. You typically create a string with a string literal, enclosed in quotes: “This is an example of a string.”

Some characters aren’t printable, but you still need to use them in strings. Therefore, C# has a special syntax where characters can be escaped to represent non-printable characters.

For example, it is common to use newlines in text, which is represented by the ‘\n’ char. The backslash, ‘\’, represents the escape. When preceded by the escape character, the ‘n’ is no longer interpreted as an alphabetical character, but now represents a newline.

Yes No Suggest edit
Suggest Edit