C# two double quotes

前端 未结 11 1548
灰色年华
灰色年华 2020-12-10 03:54

I want to print two double quotes in C# as the output. How to do this?

I mean the output should be: \"\" Hello World \"\"

11条回答
  •  忘掉有多难
    2020-12-10 04:46

    Console.WriteLine("\"\"Hello world\"\"");
    

    The backslash ('\') character precedes any 'special' character that would otherwise be interpreted as your code instead of as part of the string to be output. It's a way of telling the compiler to treat it as a character part of a string as opposed to a character that would otherwise have some sort of purpose in the C# language.

提交回复
热议问题