Is it possible to get RestSharp to deserialize this Xml snippet, into a single class, instead of two classes?
<shippingInfo>
<shippingServiceCost currencyId="AUD">58.02</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
</shippingInfo>
Notice the first element shippingServiceCost
? it has an attribute there. Normally, I would just create a child class called ShippingServiceCost
and add two properties in there: CurrentId
and Value
.
But it it possible to have the CurrencyId value in a property, in the main class ShippingInfo
?
The way I would do it, could be:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.