It's a verbatim string indicator. Refer to the cheatsheet here. When dealing with a string that needs slashes (which are normally the start of an escape sequence) it can be hard to understand the string. \\MyPath\\Test.txt
is harder to read than \MyPath\Test.tx
. But since slash starts an escape sequence the parser sees \M
specially and doesn't know how to handle it. So for this kind of string preceding it with @ tells the parser to ignore escape sequences. Hence @"\MyPath\Test.txt
translates to \MyPath\Test.txt
.
Use verbatim strings for string literals containing slashes that are not escape sequences.