Special characters : Escape sequences « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Security.Cryptography;

public class MainClass
{
    public static void Main()
    {
        Console.WriteLine("Single quote \\': {0} ({1})", '\'', (int)'\'');
        Console.WriteLine("Double quote \\\": {0} ({1})", '\"', (int)'\"');
        Console.WriteLine("Backslash \\\\: {0} ({1})", '\\', (int)'\\');
        Console.WriteLine("Unicode null \\0: {0} ({1})", '\0', (int)'\0');
        Console.WriteLine("Alert \\a: {0} ({1})", '\a', (int)'\a');
        Console.WriteLine("Backspace \\b: {0} ({1})", '\b', (int)'\b');
        Console.WriteLine("Horizontal tab \\t: {0} ({1})", '\t', (int)'\t');
        Console.WriteLine("Newline \\r: {0} ({1})", '\r', (int)'\r');
        Console.WriteLine("Vertical quote \\v: {0} ({1})", '\v', (int)'\v');
        Console.WriteLine("Form feed \\f: {0} ({1})", '\f', (int)'\f');
        Console.WriteLine("Carriage return \\r: {0} ({1})", '\r', (int)'\r');
    }

}
Single quote \': ' (39)
Double quote \": " (34)
Backslash \\: \ (92)
Unicode null \0:   (0)
Alert \a:  (7)
Backspace \b: (8)
Horizontal tab \t:       (9)
 (13)ne \r:
Vertical quote \v:  (11)
Form feed \f:  (12)
 (13)age return \r:








2.19.Escape sequences
2.19.1.Special characters
2.19.2.Escape sequences in strings: \n (new line)
2.19.3.Escape sequences in strings: \t (tab)
2.19.4.Escape sequences in strings: embed quotes
2.19.5.Character escape sequence: \0
2.19.6.Escape Characters
2.19.7.The following string is printed verbatim thus, all escape characters are displayed.
2.19.8.White space is preserved with verbatim strings