Verbatim Strings : Verbatim literal strings « String « C# / CSharp Tutorial






A verbatim string literal begins with an @, which is followed by a quoted string.

The contents of the quoted string are accepted without modification and can span two or more lines.

using System;

class MainClass
{
    public static void Main()
    {
        string s = @"
        C: asdfasdf
        O: 'Miss' &
        C: asdfasdf";
        
        Console.WriteLine(s);
    }
}
C: asdfasdf
        O: 'Miss' &
        C: asdfasdf








5.2.Verbatim literal strings
5.2.1.Verbatim Strings
5.2.2.Verbatim literal strings: multiple line string
5.2.3.Verbatim literal strings: quote
5.2.4.Regular String Constants and Verbatim (@) String Constants