我需要打印把」在逐字字符串與C#
a
"b"
c
與vebatim串,我提出了關於多行代碼模板here另一個問題
我試圖與逐字字符串如下:
using System;
class DoFile {
static void Main(string[] args) {
string templateString = @"
{0}
\\"{1}\\"
{2}
";
Console.WriteLine(templateString, "a", "b", "c");
}
}
但是,我得到這個錯誤。
t.cs(8,11): error CS1525: Unexpected symbol `{'
t.cs(9,0): error CS1010: Newline in constant
t.cs(10,0): error CS1010: Newline in constant
\"{1}\"
也不工作。
怎麼了?
可能重複[我可以在逐字串字面值中使用雙引號嗎?](http://stackoverflow.com/questions/1928909/can-i-escape-a-double-quote-in-a-verbatim -string-literal) – Ash 2017-03-22 12:28:06