Do you know how I can explicitlyt assign xml content to a string ? Example :
string myXml = "
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
"
I want to do this but with a quite bigger file.I need it because I want to use it in my Unit testing but it shows lots of errors when I am trying to paste the content between the quotes.
You need to verbatim string literal (string which starts with @
symbol) with escaped quotes (i.e. use double ""
instead of single "
):
string myXml = @"
<?xml version=""1.0""?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
";