标签:code linq color tox 1.0 tostring child class dem
1 public string XmlString() 2 { 3 XDocument xdoc = new XDocument( 4 new XDeclaration("1.0","UTF-8","yes"), 5 new XElement("Root", 6 new XElement("Child","child1"), 7 new XElement("Child","child2")) 8 ); 9 xdoc.Save("demo.xml");//会显示xml头声明 10 //return xdoc.ToString();//不会显示xml头声明 11 return xdoc.Declaration.ToString()+xdoc.ToString();//这样才会显示xml头声明 12 }
标签:code linq color tox 1.0 tostring child class dem
原文地址:https://www.cnblogs.com/CoderKobe/p/10826438.html