This is a .NET question for C# (or possibly VB.net), but I am trying to figure out what\'s the difference between the following declarations:
string hello =
It's a verbatim string literal. It means that escaping isn't applied. For instance:
string verbatim = @"foo\bar";
string regular = "foo\\bar";
Here verbatim
and regular
have the same contents.
It also allows multi-line contents - which can be very handy for SQL:
string select = @"
SELECT Foo
FROM Bar
WHERE Name='Baz'";
The one bit of escaping which is necessary for verbatim string literals is to get a double quote (") which you do by doubling it:
string verbatim = @"He said, ""Would you like some coffee?"" and left.";
string regular = "He said, \"Would you like some coffee?\" and left.";