Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# two double quotes

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

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

like image 205
sai sindhu Avatar asked Mar 06 '12 11:03

sai sindhu


Video Answer


2 Answers

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

or

Console.WriteLine(@""""" Hello world """"");
like image 108
Balazs Tihanyi Avatar answered Sep 17 '22 17:09

Balazs Tihanyi


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)

like image 23
Chris Avatar answered Sep 18 '22 17:09

Chris