Skip to content

Instantly share code, notes, and snippets.

@RyanDurkin
Created September 30, 2012 18:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save RyanDurkin/3808100 to your computer and use it in GitHub Desktop.
Product Price Class
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