我可以在逐字字符串文字中转义双引号吗?


在C#中的逐字串字符串(@“foo”),反斜杠不被视为转义,所以做“双引号不起作用。有没有什么办法在逐字串字符串中获得双引号?

这可以理解,不起作用:

string foo = @"this "word" is escaped";

使用重复的双引号。

@"this ""word"" is escaped";

输出:

this "word" is escaped

使用双引号。

string foo = @"this ""word"" is escaped";

未经作者同意,本文严禁转载,违者必究!