Double quotes inside string HTML

c#, string

Solution

use single quotes, instead.

var html = "<span class='icon phone'>m</span>";

or double the quotes in a literal string

var html = @"<span class=""icon phone"">m</span>";

or escape the quote characters with the backslash character

var html = "<span class=\"icon phone\">m</span>";

Problem

I want to store this: ``` <span class="icon phone">m</span> ``` in a string. How do I do this? Tried: `@"<span class="+"icon phone"+">m</span>";` Tried: `@"<span class="+@"icon phone"+">m</span>";` Please help!

Original source

Related problems