How to avoid double quote in C # strings?

In Ruby, you can use strings without having to avoid double quotes in a string, for example Q / Some my string with "double quotes" /

Is it possible to use C # to use a string without having to avoid double quotes? For good reason, I need to write inline SQL and be very annoying to avoid double quotes every time I put an SQL query from the DB console into C # code.

I know that you can use \ "or" "as a single double quote. But can you avoid the need to avoid double quotes?

+5
source share
3 answers

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

+4

, . "foo \" bar" @"foo "" bar", . , , " SQL; ' [/] / - , , SQL Server.

, , SQL , , . , , , "".

+9

SQL, , SQL- # .

If you are writing an Inline Sql query, you don’t need to worry about quotes if you passed values ​​through SqlParameters. Thus, you will not see annoying double quotes, where even your request will be safe from Sql Injection

0
source

All Articles