所有反序列化的作品除了列表:将xml解压缩到C#列表为空?
(resdes是一个列表)
public class SearchResponse
{
// ELEMENTS
[XmlElement("ResDes")]
public ResDes resdes { get; set; }
[XmlElement("Return")]
public Return returns { get; set; }
// CONSTRUCTOR
public SearchResponse()
{}
}
这个工程:
<Return>
<test>0010000725</test>
</Return>
public class Return
{
// ELEMENTS
[XmlElement("test")]
public Test test{ get; set; }
}
,但项目的列表还不行deserailizes成空
<ResDes >
<item>
<PoBox />
<City1>South Korea</City1>
<Country>SK</Country>
</item>
</ResDes >
public class ResDes
{
// ELEMENTS
[XmlArrayItem("item")]
public List<ResDesItem> ResDesItem { get; set; }
// CONSTRUCTOR
public ResDes()
{ }
}
Resdesitem class:
[DataContract()]
public class ResDesItem
{
[XmlElement("PoBox")]
public PoBox PoBox { get; set; }
[XmlElement("City1")]
public City1 City1 { get; set; }
[XmlElement("Country")]
public EtResultDetAdritemCountry EtResultDetAdritemCountry { get; set; }
// CONSTRUCTOR
public ResDesItem()
{ }
}
你尝试用'[Serializable]'属性标记ResDesItem类吗? – jglouie
嗨,我目前正在为手机平台开发,所以我使用它的等价的[DataContract()],但它仍然是空的 – Bohrend
“ResDesItem”类在哪里?你可以粘贴这个类吗? – jglouie