#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#

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: