C# Console.WriteLine but text contains ""

79 Views Asked by At

I want to write something with Console.WriteLine, but the text contains "". Example:

Console.WriteLine("example: "this is an example" example");

How to avoid this problem?

I tried '' and other symbols, but it didn't work

1

There are 1 best solutions below

0
Jeff Chen On BEST ANSWER

Use the backslash character to mark the quotations, as shown:

Console.WriteLine("example: \"this is an example\" example");

This is used in languages to mark special characters, in this case marking the quotation so that it doesn't end the string prematurely.