【发布时间】:2012-12-10 13:47:16
【问题描述】:
是否可以让 RestSharp 将此 Xml sn-p 反序列化为一个类,而不是两个类?
<shippingInfo>
<shippingServiceCost currencyId="AUD">58.02</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
</shippingInfo>
注意到第一个元素 shippingServiceCost 了吗?它在那里有一个属性。通常,我会创建一个名为 ShippingServiceCost 的子类并在其中添加两个属性:CurrentId 和 Value。
但是否可以在属性中包含 CurrencyId 值,在主类 ShippingInfo 中?
【问题讨论】:
标签: c# .net xml deserialization restsharp