C# Language Verbatim strings instruct the compiler to not use character escapes


In a normal string, the backslash character is the escape character, which instructs the compiler to look at the next character(s) to determine the actual character in the string. (Full list of character escapes)

In verbatim strings, there are no character escapes (except for "" which is turned into a "). To use a verbatim string, just prepend a @ before the starting quotes.

This verbatim string

var filename = @"c:\temp\newfile.txt"



As opposed to using an ordinary (non-verbatim) string:

var filename = "c:\temp\newfile.txt"

that will output:

c:    emp

using character escaping. (The \t is replaced with a tab character and the \n is replace with a newline.)

Live Demo on .NET Fiddle