Note: This article was originally published in 2011. Some steps, commands, or software versions may have changed. Check the current .Net documentation for the latest information.

C# defines the following character escape sequences:

  • ' - single quote, needed for character literals
  • " - double quote, needed for string literals
  • “ - backslash
  • “ - 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 - 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)