c# - How to create this kind of XML? -
i want create via c# code xml this:
<title> <a> <aaaaaaaaaaaaa/> </a> <b> <bbbbbbbbbbbbb/> </b> </title>
with code should create tree thist?
well, if can use linq xml it's insanely easy:
xelement root = new xelement( "title", new xelement("a", new xelement("aaaaaaaaaaaaa")), new xelement("b", new xelement("bbbbbbbbbbbbb")) );
additionally, if need build dynamically data (which will), can include queries within constructor calls, , work.
linq xml impressively easy-to-use api. of course, require .net 3.5 or higher.
Comments
Post a Comment