Escaping Double Quotes

Download c# eBook

Example

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.

Live Demo on .NET Fiddle

Stats

Contributors: 9
2017-04-06
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook