Writing Multi-Line Strings in C#

In C#, there are many features that help me to coding easily. In this time, I am working with getting data from database by using web service. I have a question that “How could I handle with the long string (SQL Statement) ?”. The first attempt is to use “+” to connect string in multiple lines together as follow.

It would be OK at first to use “+” to connect multiple strings, but I have worked with string in VB which is the line-sensitive language. I can put “_” after the end of the line to indicate that the current line is not finished yet (there is another line to continue). Then, I have another question “Is there any way to split the long string in multi-line as VB?”. So I try to just press “Enter” to split the string, but it doesn’t work.

I searched through the Internet and finally I found the solution. C# have some thing called string literal (represent as @) to span stings to multiple lines. So, I did it. YEAH! 🙂

Thank you jameskovacs for saving my life. 😉