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!
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>";
You can also omit the @ and escape the double quote with a backslash \
:
"<span class=\"icon phone\">m</span>"
How about
new XElement("span", new XAttribute("class", "icon phone"), "m").ToString()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With