• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 593
  • Last Modified:

Including double quotes inside a String -- C# syntax

Hello Experts.

I'm new to C#. I am having difficulty using double quotation marks inside a String.  

I am creating an HTML email using message.Body and I would like to include a <a href>
ie.  
message.Body = "Here's my <a href="testlink.com">link</a>";

I'm getting an ( ; expected ) error around my double quotes inside the <a href> tag.understand why, but I'm having trouble finding the right syntax.  

How is this accomplished with C#?

Thanks.
0
soapygus
Asked:
soapygus
  • 2
1 Solution
 
JimBrandleyCommented:
You can do it this way:
message.Body = "Here's my <a href=\"testlink.com\">link</a>";

Jim
0
 
soapygusAuthor Commented:
Thanks Jim!
0
 
JimBrandleyCommented:
My pleasure. Good luck.

Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now