really simple question… just want to represent double quote ” without needing to do “” or \”
cases that I’m aware of:
var s=@"123 "" 456 """;
var s="123 \" 456 \"";
It’d make a reasonalbe difference if I could remove this noise somehow. The reason is that the escape sequence \ and the double quote have meaning in a domain specific language (DSL) that we’re using. Sometimes it’s convenient to throw some syntax inline into a C# string.
What I’d like is a way to tell .net not to touch it. Perhaps some kind of catch all via the DLR?
Within a C# literal, there’s nothing you can to – don’t forget this is all done at compile-time.
If you don’t use single quotes, you could always do:
(Or choose some other character you don’t use much, and replace that afterwards instead.)
Other than that, avoiding storing lots of data in your source code helps a lot with this sort of thing – for test data, I often use an embedded resource and load that in at execution time.