0
<SHEET>
<books title ='title'>
<book label='1' page='1' intro='1'/>
<book label='2' page='2' intro='2'/>
<book label='3' page='3' intro='3'/>
</books>
<books title ='title'>
<book label='1' page='1' intro='1'/>
<book label='2' page='2' intro='2'/>
<book label='3' page='3' intro='3'/>
</books>
</SHEET>
所以我有這段代碼,我使用它來獲取書中項目的屬性。 我用這個代碼:序列化獲取節點信息
[XmlRoot("SHEET")]
public class BookRoot
{
private readonly List<Book> books = new List<Book>();
[XmlArray("books"), XmlArrayItem("book")]
public List<Book> Books { get { return books; } }
}
public class Book {
[XmlAttribute("label")]
}
我還需要retireve本本性能,我該怎麼做呢?
看看這個:http://stackoverflow.com/questions/8790807/how-do-i-give-an-array-an-attribute-during-serialization-in-c – 2014-09-03 09:32:27
嗯,謝謝,這是相反的,從C#到XML,我不理解它... – 2014-09-03 09:37:08
好吧,序列化和反序列化使用相同的C#類... – 2014-09-03 09:57:02