使用“@”符号连接字符串中的变量

Fas*_*ack 3 c# string-concatenation

给定这个多行字符串:

string strProviderJSON = @"
                {
                    ""npi"":""1111111111"",
                    ""name"":""DME Clearinghouse"",
                    ""email"":""my@doc.como"",
                    ""contactName"":""Sally Smith"",
                    ""fax"":"""",
                    ""address"":{
                        ""country"":""United States"",
                        ""street1"":""27787 Dequindre Apt 616"",
                        ""street2"":"""",
                        ""city"":""Madison Heights"",
                        ""state"":""MI"",
                        ""zipCode"":""32003""
                    },
                    ""phone"":""(904) 739-0300"",
                    ""contactPhone"":""(904) 739-0300""
                }
            ";
Run Code Online (Sandbox Code Playgroud)

如何在其中连接变量?我尝试了这个,但不断出现错误:

string strTest = "1111111111";
string strProviderJSON = @"
                {
                    ""npi"":""" + strTest + """,
                    ""name"":""DME Clearinghouse"",
                    ""email"":""my@doc.como"",
                    ""contactName"":""Sally Smith"",
                    ""fax"":"""",
                    ""address"":{
                        ""country"":""United States"",
                        ""street1"":""27787 Dequindre Apt 616"",
                        ""street2"":"""",
                        ""city"":""Madison Heights"",
                        ""state"":""MI"",
                        ""zipCode"":""32003""
                    },
                    ""phone"":""(904) 739-0300"",
                    ""contactPhone"":""(904) 739-0300""
                }
            ";
Run Code Online (Sandbox Code Playgroud)

Dai*_*Dai 5

将另一个@字符附加到下一个字符串文字的开头。

...
""npi"":""" + strTest + @"""
""name"": ""DME Clearinghouse"",
...
Run Code Online (Sandbox Code Playgroud)