Product Price Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Xml.Serialization; | |
using System.IO; | |
using System.Xml; | |
[Serializable] | |
[XmlRoot(ElementName = "product_price")] | |
public class ProductPrice | |
{ | |
[XmlElement("tcm_id")] | |
public string TcmId { get; set; } | |
[XmlElement("product_tcm_id")] | |
public string ProductTcmId { get; set; } | |
[XmlElement("three_month_rate")] | |
public decimal ThreeMonthRate { get; set; } | |
[XmlElement("twelve_month_rate")] | |
public decimal TwelveMonthRate { get; set; } | |
public static ProductPrice Deserialize(string xml) | |
{ | |
ProductPrice result; | |
using (var stringReader = new StringReader(xml)) | |
using (var xmlReader = XmlReader.Create(stringReader)) | |
{ | |
var serializer = new XmlSerializer(typeof(ProductPrice)); | |
result = (ProductPrice)serializer.Deserialize(xmlReader); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment