Escaping characters in C#

C# defines the following character escape sequences:

  • \' - single quote, needed for character literals
  • \" - double quote, needed for string literals
  • \\ - backslash
  • \0 – Null
  • \a - Alert
  • \b - Backspace
  • \f - Form feed
  • \n - New line
  • \r - Carriage return
  • \t - Horizontal tab
  • \v - Vertical quote
  • \u - Unicode escape sequence for character
  • \U - Unicode escape sequence for surrogate pairs.
  • \x - Unicode escape sequence similar to "\u" except with variable length.

Comments