Search code examples
c#c#-4.0double-quotes

How to avoid double quote escape in C# strings?


In Ruby it's possible to use the strings without the need to escape the double quote in the string, like Q/Some my string with "double quotes"/

Is it possible with C# to use a string without a need to escape double quotes? For a good reason I need to write inline SQL and it's very annoying to escape double quotes every time I put SQL query from DB console to C# code.

I know it's possible to use \" or "" as one double quote. But is it possible to avoid the need to escape the double quotes?


Solution

  • No, this is not possible in C#. You could write your SQL in a separate file and then read it from there.