Including double quotes inside a String -- C# syntax

Posted on 2007-10-21
Last Modified: 2013-11-07
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>
message.Body = "Here's my <a href="">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#?

Question by:soapygus
    LVL 22

    Accepted Solution

    You can do it this way:
    message.Body = "Here's my <a href=\"\">link</a>";


    Author Comment

    Thanks Jim!
    LVL 22

    Expert Comment

    My pleasure. Good luck.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now