I would like to be able to paste chunks of XML into my C# code.
我希望能够将XML块粘贴到c#代码中。
However, the best I can do is the following, but then I have to search and replace " with "".
然而,我所能做的最好的事情是下面这些,但是我必须搜索并替换“with”。
Is there a way to define multiline XML in C# code without having to alter the XML text like this?
是否有一种方法可以在c#代码中定义多行XML,而不必像这样修改XML文本?
public static string GetXml1()
{
return @"
<Customer>
<FirstName status=""required"">Jim</FirstName>
<LastName status=""required"">Smith</LastName>
</Customer>
";
}
2 个解决方案
#1
5
Store the XML as a string resource then retrieve the XML as using ResourceManager
.
将XML存储为字符串资源,然后使用ResourceManager检索XML。
#2
0
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.
不一定是你想要的,但是框/列选择可能会有帮助,如果线是短的。按住“Alt”键,同时用鼠标选择“想要删除”,然后按“删除”键。
#1
5
Store the XML as a string resource then retrieve the XML as using ResourceManager
.
将XML存储为字符串资源,然后使用ResourceManager检索XML。
#2
0
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.
不一定是你想要的,但是框/列选择可能会有帮助,如果线是短的。按住“Alt”键,同时用鼠标选择“想要删除”,然后按“删除”键。