Use XML Literals in C#?

后端 未结 5 1873
遇见更好的自我
遇见更好的自我 2020-12-05 23:16

Is it possible to add literal XML data within a C# code file? I\'m currently using a multiline string literal but it gets messy as you can see. Any better way of doing this?

5条回答
  •  独厮守ぢ
    2020-12-05 23:45

    XML literals are a feature of VB.NET, not C#.

    What you have posted is as close as you can get in C#.

    You may want to consider replacing the embedded double quotes with single quotes though (as both types are valid XML).

    For larger amounts of XML you may want to consider the answer from Marc - using an XML file (loaded once and stored in memory), so you can take advantage of the XML editor.

提交回复
热议问题