Basic C# Console General

Character Escape Sequences in C#

Sometimes it is necessary to work with characters that are not displayed on the keyboard or with characters that have special meanings, such as the “new line” character. They cannot be represented directly in the source code of the program and in order to use them we need special techniques, which we
will discuss now.

Escaping sequences are literals. They are a sequence of special characters, which describe a character that cannot be written directly in the source code. This is, for instance, the “new line” character. There are many examples of characters that cannot be represented directly in the source code: a double quotation mark, tab, new line, backslash and others.

Here are some of the most frequently used escaping sequences:

Example:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.