C# 中如何输出双引号(转义字符的使用)

输出这样的一个含有双引号的字符串

"hello"

方式一:

不用 @ 时转义
      System.Console.WriteLine("\"hello\"");

方式二:
用 @ 时, 两个引号表示一个引号
      System.Console.WriteLine(@"""hello""");

需要注意的是,使用符号@时候,两个双引号在输出时候等价于1个双引号,  即“” 等价于 ”
 

猜你喜欢

转载自blog.csdn.net/tmjianjun/article/details/103309185