是否可以让 RestSharp 将此 Xml 片段反序列化为单个类,而不是两个类?
<shippingInfo>
<shippingServiceCost currencyId="AUD">58.02</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
</shippingInfo>
注意第一个元素shippingServiceCost?它在那里有一个属性。通常,我只会创建一个名为的子类ShippingServiceCost并在其中添加两个属性:CurrentId和Value.
但是有可能在主类的属性中包含 CurrencyId 值ShippingInfo吗?