I can not find an easy way to do what I m asking for. I have an object:
public class Item
{
public string Name { get; set; }
}
我想:
(1) 创建 xml 文档 :
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item Name="Item1"/>
<Item Name="Item2"/>
</Items>
(2) 读取 xml 文档:
for each NodeT node in MyXMLDocument
{
Item i = new Item(node);
}
3) 管理 xml 文档,例如删除项目1并添加项目3(或更改属性值)
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item Name="Item2"/>
<Item Name="Item3"/>
</Items>
How can I do this as simply as possible? Thanks.