c#中长字符串换行

有时候在代码中不得不写很长的一句sql语句。那么怎样才能换行使看起来很容易呢?

最好的办法是用@符号.

而@的意思就是告诉编译器,这里面的字符不需要转义,如下面的sql语句:  

string SQL = @"select

                    a.numid,a.vc2title,

                    vc2type=case when a.vc2type='1' then '' when a.vc2type='2' then '' end ,

                    a.numuserid,datAdd=convert(varchar(10),a.datadd,111),a.vc2term ,b.vc2username

               from T_supply a left join u_user b on a.numuserid=b.user_id

               where a.vc2status='{0}'";

  SQL= string.Format(SQL,type);

原文地址:https://www.cnblogs.com/wenming205/p/1289945.html