How can i set the following text to a variable of type string?
<li><a href='#M'>M</a></li>
<li><a href='#B'>B</a></li>
<li><a href='#K'>K</a></li>
Is there any simple way i can set a string variable with a code similar to the bellow:
StringWriter s = new StringWriter();
s.WriteLine("{0}", @"
<li><a href='#M'>M</a></li>
<li><a href='#B'>B</a></li>
<li><a href='#K'>K</a></li>
");
Firstly you need to escape
"inside your string (do this with a\), secondly you either need to make it single line or you need to concatenate each line:In this case I’d prefer to use single line string.