I want to print two double quotes in C# as the output. How to do this?
I mean the output should be: "" Hello World ""
Console.WriteLine("\"\" Hello world \"\"");
or
Console.WriteLine(@""""" Hello world """"");
If you want to put double quotes in a string you need to escape them with a \
eg:
string foo = "here is a \"quote\" character";
If you want to literally output "" Hello World ""
then you'd need:
string helloWorld = "\"\" Hello World \"\"";
output(helloWorld);
(where output is whatever method you are using for output)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With