Verbatim strings instruct the compiler to not use C# with Example



Verbatim strings instruct the compiler to not use C# with Example

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" 
Output: 
 

c:\temp\newfile.txt 
As opposed to using an ordinary (non-verbatim) string: 
var filename = "c:\temp\newfile.txt" 
that will output: 
c: emp 
ewfile.txt 
using character escaping. (The \t is replaced with a tab character and the \n is replace with a newline.) 
Live Demo on .NET Fiddle 

0 Comment's

Comment Form