我想把这些字符串放在一个列表中,我该怎么做?保持是在前两行中找到的双""
。我该如何解决这个问题?
scriptTxt = new string[]
{
"#$language = "VBScript"",
"#$interface = "1.0"",
"crt.Screen.Synchronous = True",
"Sub Main"
};
答案 0 :(得分:5)
scriptTxt = new string[]
{
"#$language = \"VBScript\"",
"#$interface = \"1.0\"",
"crt.Screen.Synchronous = True",
"Sub Main"
};
或者
scriptTxt = new string[]
{
@"#$language = ""VBScript""",
@"#$interface = ""1.0""",
"crt.Screen.Synchronous = True",
"Sub Main"
};
答案 1 :(得分:1)
使用反斜杠转义引号。 (撇号是')
scriptTxt = new string[]
{
"#$language = \"VBScript\"",
"#$interface = \"1.0\"",
"crt.Screen.Synchronous = True",
"Sub Main"
};