开发者

How do I create a string from a block of text that contains the " character

开发者 https://www.devze.com 2023-01-06 22:08 出处:网络
I\'ve got a block of html code that includes some form action stuff, which has the \" appearing a lot.

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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消