我有两个名为Movie和Movie Type的类,我试图根据给出的示例xml创建该类的对象。如何从XML文档中提取数据
public class Movie
{
public string title;
public string rating; //can always convert.toin32 later
}
public class Genre
{
int id;
string genreType;
}
我想基于以下XML创建该类的对象,什么是最好/最快的方式?
<movie>
<title> se7en </title>
<genre> thriller</genre>
<rating> 18 </rating>
</movie>
<movie>
<title> zodiac </title>
<genre> thriller</genre>
<rating> 18 </rating>
</movie>
[转换XML使用反射对象](HTTP可能重复:// stackoverflow.com/questions/3268912/convert-xml-to-object-using-reflection) – Bio42 2015-02-11 09:59:06
可能使用Linq查询记录的Xml文件的副本(http://stackoverflow.com/questions/26422431/query-xml-file-for-records-using-linq) – 2015-02-11 10:20:26