我有xml如下
<FbiXml>
<Ticket>
<UserID>1</UserID>
<Key>lEPLCl+NUOv6eOrETE8Row==</Key>
</Ticket>
<FbiMsgsRs statusCode="1000">
<SaveSORs statusCode="2100" statusMessage="Was not able to find the product MGAS003-KT."/>
</FbiMsgsRs>
</FbiXml>
我有相关的可序列化类
public partial class FbiMsgsRq
{
private object[] itemsField;
[XmlElementAttribute("SOSaveRs", typeof(SaveSORsType),IsNullable = true)]
[XmlElementAttribute("SaveDiscountRs", typeof(SaveDiscountRsType),IsNullable = true)]
[XmlElementAttribute("SaveShipmentRs", typeof(SaveShipmentRsType),IsNullable = true)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
......
}
问题:当上面的xml被反序列化时,Items属性返回null ,但我有一个元素,这是一个空元素。但我在类IsNullable = true中标记了Items属性,使其序列化。
但我仍然得到空项元素,我需要获取该属性的属性值。如何实现这一目标?