在
其中xml文件中不同的節點對應不同的實體類
books
<books>
<book bookname=
<book bookname=
<book bookname=
</books>
與之相對應的實體類及操作
Books
Books
[XmlRoot(
public class Books:List<Book>
{
public static Books LoadConfig(string file)
{
XmlSerializer xs = new XmlSerializer(typeof(Books));
StreamReader sr = new StreamReader(file);
Books config = xs
sr
return config;
}
public void SaveConfig(string file)
{
XmlSerializer xs = new XmlSerializer(typeof)
From:http://tw.wingwit.com/Article/program/net/201311/15394.html