If I write something like this:
string s = @"...."......";
it doesn't work.
If I try this:
string s = @"...\".....";
it doesn't work either.
How can I add a " character to a multi line string declaration in C#?
If I write something like this:
string s = @"...."......";
it doesn't work.
If I try this:
string s = @"...\".....";
it doesn't work either.
How can I add a " character to a multi line string declaration in C#?
The double character usage also works with the characters { and } when you're using string.Format and you want to include a literal instance of either rather than indicate a parameter argument, for example:
string jsString = string.Format(
"var jsonUrls = {{firstUrl: '{0}', secondUrl: '{1}'}};",
firstUrl,
secondUrl
);
string s = "...\"....."; should work
the @ disables escapes so if you want to use \" then no @ symbol
Personally i think you should go with
string s = string.format("{0}\"{1},"something","something else");
it makes it easier in the long run