In javascript I can write
var s = 'He said "Hello" to me';
or
var s = "don't be sad";
In other words, if I want a double quote in the string, I can declare the string using single quotes. If I want a single quote in the string, I can declare the string using double quotes. This is super handy. Has anyone found a way to do something similar in C#?
The single quotes are easy, c# already works with embedding single quotes. As for double quotes, there seems to be 2 common options.
use backslash escape character
var s = "He said \"Hello\" to me";
use single quotes and replace them with double quotes
var s = "He said 'Hello' to me"; s = s.Replace("'","\"");
I can live with option 2, but better is better.