A double quoted string prefixed with an at (@) sign symbol will be interpreted verbatim.
Syntax
@"<STRING>"
The STRING token can have simple escaped sequences (e.g. \\ for backslash), hexadecimal escape sequence (i.e. \x<HEX_NUMBER>) and unicode escape sequences (i.e. \u<HEX_NUMBER>) that are interpreted literally. However, the "" will still be escaped an will produce a single double quote mark.
Verbatim string literal and string interpolation can be combined with the syntax as $@"<STRING>". Moreover, the {{ or }} will still be escaped.
Example
var string1 = "C:\\Windows\\System32" var string2 = @"C:\Windows\System32" Console.WriteLine(string1) Console.WriteLine(string2)
The writelines will produce the same output.
Leave a Reply