What's the @ in front of a string in C#?
It marks the string as a verbatim string literal - anything in the string that would normally be interpreted as an escape sequence is ignored.
Regular literal | Verbatim literal | Resulting string |
---|---|---|
"Hello" | @"Hello" | Hello |
"Backslash: \\" | @"Backslash: \" | Backslash: \ |
"Quote: \"" | @"Quote: "" | Quote: " |
"CRLF:\r\nPost CRLF" | @"CRLF: Post CRLF" | CRLF: Post CRLF |
No comments:
Post a Comment