我正在反序列化从 Web 服务获得的 XML。这是对象的外观:
[Serializable]
public class DocketData
{
[XmlElement(ElementName = "PolicyList")]
public List<PolicyItem> PolicyList { get; set; }
}
这是 PolicyItem:
[Serializable]
public class PolicyItem
{
[XmlElement(ElementName = "companyName")]
public string CompanyName { get; set; }
[XmlElement(ElementName = "attnToName")]
public string AttnToName { get; set; }
[XmlElement(ElementName = "address")]
public string Address { get; set; }
[XmlElement(ElementName = "city")]
public string City { get; set; }
这是 XML:
<DocketData>
<PolicyList>
<PolicyItem>
<companyName>CRUM &MPANY</companyName>
<attnToName>TO REPORT00</attnToName>
<address>305 AVE.</address>
当我使用 Xml 序列化程序反序列化时,它似乎正确地获得了一项 PolicyItem 但它不会反序列化它的属性