What are the escape sequences supported by C#?

CsharpProgrammingServer Side Programming

The following is an example showing how to display some of the escape characters in C# −


using System;
using System.Collections.Generic;

class Demo {
   static void Main() {

      Console.WriteLine("Warning!" + '\u0007');

      Console.WriteLine("Test \t Demo Text");

      Console.WriteLine("This is it!\nThis is on the next line!");

For the complete list of escape sequences in C# −

Escape characterDescriptionPattern
\aMatches a bell character, \u0007.\a
\bIn a character class, matches a backspace, \u0008.[\b]{3,}
\tMatches a tab, \u0009.(\w+)\t
\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character, \n.)\r\n(\w+)
\vMatches a vertical tab, \u000B.[\v]{2,}
\fMatches a form feed, \u000C.[\f]{2,}
\nMatches a new line, \u000A.\r\n(\w+)
\eMatches an escape, \u001B.\e
Published on 13-Aug-2018 13:01:58