#66 – Including Quotation Marks in Strings

There are a couple of different ways to include quotation marks in string literals.

The first is to use an escape sequence:

 Console.WriteLine("I like \"coding\" in C#");

If you use verbatim string literals, you can instead just use double quotation marks:

 Console.WriteLine(@"I like ""coding"" in C#");

In either case, the output is:  I like “coding” in C#

Advertisement