Skip to main content

C# Character Escape Sequences

Character combinations consisting of a backslash (\) followed by a letter or by a combination of digits are called "escape sequences." To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences. An escape sequence is regarded as a single character and is therefore valid as a character constant.

Escape sequences are typically used to specify actions such as carriage returns and tab movements on terminals and printers. They are also used to provide literal representations of nonprinting characters and characters that usually have special meanings, such as the double quotation mark ("). The following table lists the ANSI escape sequences and what they represent.


C# defines the following character escape sequences:
 
  • \' - single quote, needed for character literals
  • \" - double quote, needed for string literals
  • \\ - backslash
  • \0 - Unicode character 0
  • \a - Alert (character 7)
  • \b - Backspace (character 8)
  • \f - Form feed (character 12)
  • \n - New line (character 10)
  • \r - Carriage return (character 13)
  • \t - Horizontal tab (character 9)
  • \v - Vertical quote (character 11)
  • \uxxxx - Unicode escape sequence for character with hex value xxxx
  • \xn[n][n][n] - Unicode escape sequence for character with hex value nnnn (variable length version of \uxxxx)
  • \Uxxxxxxxx - Unicode escape sequence for character with hex value xxxxxxxx (for generating surrogates

  • source : MSDN

    Comments

    Popular posts from this blog

    Windows 8 Icons: Segoe UI Symbol

    Whatz up guyz... In this post i am going to tell you about "Windows 8 Icons" . If you ever used a windows 8 app, you know that there are so many standard Icons. Actually we do not want to add images for each button, simply we can use the character map for obtain the icons.Go to the character map and select the font as "Segoe UI Symbol" .Then you will see lot of standard symbols in the character map.

    CsharpForBeginers 02 - Showing MessageBoxes

    Hi guyz ... This is the second part of MessageBoxes Tutorial. In this tutorial we are going to talking about how to create Yes/No message Box. MessageBoxButtons Go to the UI and double click on the Button.Then remove the all codes within the curly braces. Add following codes within the braces Code: MessageBox .Show( "Will you really remove the item?" , "Warning" , MessageBoxButtons .YesNo);