Mapping XML to classes in c#
问题 I'm looking to map multiple XML attributes in nested elements into a single POCO class using the XmlSerializer object. XML <products grand-total="100"> <one price="50" /> <two price="20" /> <tree price="30" /> </products> POCO public class Product { public int GrandTotal { get; set; } public int OnePrice { get; set; } public int TwoPrice { get; set; } public int ThreePrice { get; set; } } C# var doc = XDocument.Load("XmlDoc.xml"); var serializer = new XmlSerializer(typeof(Product)); var