我有以下 XElement
<Issue Type="Duplicate" Distance="1">
<Record>
<ID>6832</ID>
<Name_First>JAMES </Name_First>
<Name_Last>SMITH</Name_Last>
<Company>SMITH CO.</Company>
</Record>
<Record>
<ID>6831</ID>
<Name_First>JAMES</Name_First>
<Name_Last>SMITH</Name_Last>
<Company>SMITH CO.</Company>
</Record>
</Issue>
我正在尝试将它反序列化到这个对象中
public class Issue
{
[XmlAttribute]
public string Type { get; set; }
[XmlArrayItem(typeof(XElement), ElementName = "Record")]
public List<XElement> Record { get; set; }
}
该类型工作没问题,但我无法将两个 Record 节点放入对象的 Record 列表中。
是否可以不覆盖 ISerializable 并编写自定义代码?