1 回答
TA贡献1852条经验 获得超7个赞
我找到了解决方案:
public class Response
{
[System.Xml.Serialization.XmlElementAttribute("Business", typeof(ResponseBusiness), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items { get; set; }
}
public partial class ResponseBusiness
{
string NumberField;
string NameField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Number
{
get
{
return this.NumberField;
}
set
{
this.NumberField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Name
{
get
{
return this.NameField;
}
set
{
this.NameField = value;
}
}
我这样称呼XmlSerializer类:
var serializer = new XmlSerializer(typeof(Response), new XmlRootAttribute("Response"));
我可以阅读以下信息:
字符串businessNumber =(((ResponseBusiness)result.Items [0])。Number;
希望它可以帮助别人。
- 1 回答
- 0 关注
- 162 浏览
添加回答
举报