-2

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

simong
  • 3
  • 1
  • Welcome to StackOverflow! Google is great for questions like this. There's no shame in using it. I've been programming for 20 years and still use Google daily to look up how to do stuff. – Gabriel Luci Dec 02 '22 at 20:10

1 Answers1

1

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.

Jeff Chen
  • 600
  • 5
  • 13