tags:

views:

43

answers:

2

I've got a block of html code that includes some form action stuff, which has the " appearing a lot.

Is there a way I can make the entire block into a string?

public string methodName()
{
     return @ " text goes here..  blah blah  <p> a bit of html stuff</p>
<form action="www...." method="post">
<input type="hidden" name="cmd" 

I get a lots of angry red underlining from this.

A: 

hmmmm... CDATA?

Randy
+2  A: 
var html = @"<html>
<body>
    <span id=""name""> somethnig more</span>
</body>
</html>";

Placing @ before a string means that the contents should not be parsed (\n and other control characters do not work). It also means that the string can span over multiple lines and have " in it, as long as you write "" (only one will be displayed).

jgauffin
By the way, this is called a Verbatim String Literal.
Arda Xi
Ah, yeah I was missing the double "" Thanks for your help..
Matt