Multiline string literal in C#

后端 未结 13 1909
梦谈多话
梦谈多话 2020-11-22 11:15

Is there an easy way to create a multiline string literal in C#?

Here\'s what I have now:

string query = \"SELECT foo, bar\"
+ \" FROM table\"
+ \" W         


        
13条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 11:23

    You can use @ and "".

            string sourse = @"{
            ""items"":[
            {
                ""itemId"":0,
                ""name"":""item0""
            },
            {
                ""itemId"":1,
                ""name"":""item1""
            }
            ]
        }";
    

提交回复
热议问题