What is Verbatim string?
In C# we can escape the characters without using Escape character, for example we can use like @"C:\temp" instead of "C:\\temp". These strings which starts with @" and ends with matching end quotes are called as Verbatim String literals.
They don't need escape characters. Strings written using the verbatim string syntax can span multiple lines, and whitespace is preserved.
The only character that needs escaping is the double-quote character, the escape sequence for which is two double-quotes together.
For instance, suppose that you want to set the variable 'text' to the following value:
MS word "shorcut" to copy
Using the verbatim string syntax, the command would look like this:
string text = @"MS word ""shortcut"" to copy"
0 Comments:
Post a Comment
<< Home