【发布时间】:2015-09-03 14:34:01
【问题描述】:
使用 VS 2013。
我们正在通过 Web Reference 使用一些 wsdl 并获取 ws 的所有类。
我们为 ws 层次结构属性设置了值,但该属性未序列化。
我看到here 属性未序列化的原因之一是:
“它有一个返回 false 的公共 bool FooSpecified {get;set;} 属性或字段。”
因此,如果我们设置层级属性,它不会在 XML 中表示:
familyInformation = new amadeus.Fare_SellByFareSearchFareFamiliesFamilyInformation
{
fareFamilyname = "XXXX",
hierarchy = 2
}
public decimal hierarchy {
get {
return this.hierarchyField;
}
set {
this.hierarchyField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool hierarchySpecified {
get {
return this.hierarchyFieldSpecified;
}
set {
this.hierarchyFieldSpecified = value;
}
}
<familyInformation>
<fareFamilyname>XXXX</fareFamilyname>
</familyInformation>
请帮助如何获取层级属性序列化
【问题讨论】:
标签: xml visual-studio-2013 xmlserializer