Is there a way to define multiline XML in code in C# without having to change “ to ”"?
Question
I would like to be able to paste chunks of XML into my C# code.
However, the best I can do is the following, but then I have to search and replace " with "".
Is there a way to define multiline XML in C# code without having to alter the XML text like this?
public static string GetXml1()
{
return @"
<Customer>
<FirstName status=""required"">Jim</FirstName>
<LastName status=""required"">Smith</LastName>
</Customer>
";
}
Solution
Store the XML as a string resource then retrieve the XML as using ResourceManager
.
OTHER TIPS
Not necessarily what you are askin for, but Box/Column Select might help if the lines are alligned. Just hold down the 'Alt'-key while you use the mouse to select the " you want to remove and press delete.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow