winform程序 读、写xml文件

前端之家收集整理的这篇文章主要介绍了winform程序 读、写xml文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

有用到先上代码,后面总结相关知识,,,


创建:

    @H_502_8@ XmlDocumentxmlDoc=newXmlDocument();
  1. //创建类型声明节点
  2. XmlNodenode=xmlDoc.CreateXmlDeclaration("1.0","utf-8","");
  3. xmlDoc.AppendChild(node);
  4. //创建根节点
  5. XmlNoderoot=xmlDoc.CreateElement("User");
  6. xmlDoc.AppendChild(root);
  7. CreateNode(xmlDoc,root,"name","xuwei");
  8. "sex","male");
  9. "age","25");

读取:3种方法

1.XmlDocument

2.XmlTextReader

3.linq to xml

原文链接:https://www.f2er.com/xml/293722.html

猜你在找的XML相关文章