To concatenate string literals, use the @ symbol at the beginning of each string.
var combinedString = @"\\t means a tab" + @" and \\n means a newline";
Verbatim strings can be combined with the new http://stackoverflow.com/documentation/c%23/24/c-sharp-6-0-features/49/string-interpolation features found in C#6.
Console.WriteLine($@"Testing \\n 1 2 {5 - 2}
New line");
Output:
Testing \n 1 2 3
New line
As expected from a verbatim string, the backslashes are ignored as escape characters. And as expected from an interpolated string, any expression inside curly braces is evaluated before being inserted into the string at that position.
Double Quotes inside verbatim strings can be escaped by using 2 sequential double quotes ""
to represent one double quote "
in the resulting string.
var str = @"""I don't think so,"" he said.";
Console.WriteLine(str);
Output:
“I don’t think so,” he said.