像这两个类
[XmlRoot("Root")]
public class VcRead
{
[XmlElement("item")]
public string[] Items;
[XmlElement("amount")]
public int Count;
}
public class KeyItem
{
[XmlAttribute("id")]
public int ID;
[XmlAttribute("name")]
public string Title;
}
现在,我想使用反射来获取所有字段及其 Xml 标记。很容易获得字段的名称和它们的值。但是,如何获取 XmlElement 的值,例如“金额”
[XmlElement("amount")]
public int Count;