Verbatim string literal

A verbatim string literal starts with @ and doesn't escape the chars.

The following code rewrites the path in a verbatim string.


using System;

class Program
{
    static void Main(string[] args)
    {
        string path = @"c:\a\b\c\d.exe";
        Console.WriteLine(path);


    }
}

The output:


c:\a\b\c\d.exe

To use double quotes in a verbatim string:


using System;

class Program
{
    static void Main(string[] args)
    {
        string str = @"This is a ""test"" from java2s.com";
        Console.WriteLine(str);


    }
}

The output:


This is a "test" from java2s.com
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.