How do I XML deserialize an array of arrays in c#?

Snappy

New Member
I am trying to deserialize an object of credit card bins for brand validation on a form, but can't get it done properly. Either the inside object doesn't deserialize, or the main list of brands comes null. Can anyone give me a hand or two? My XML is like this:\[code\]<?xml version="1.0" encoding="utf-8"?><Brands> <Brand type="visa"> <Bins> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/123" /> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/456" /> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/789" /> </Bins> </Brand> <Brand type="master"> <Bins> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/987" /> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/654" /> <Bin enabled="true" value="http://stackoverflow.com/questions/12715805/321" /> </Bins> </Brand></Brands>\[/code\]and my latest code(which brings brandsCollection null) is:\[code\][XmlRoot("Brands")]public class CreditCardBrand{ [XmlArray("Brands"), XmlArrayItem("Brand")] public CreditCardBrandCollection[] brandsCollection { get; set; }}public class CreditCardBrandCollection{ [XmlElement("Bins")] public CreditCardBrandBins[] binsCollection { get; set; } [XmlAttribute("type")] public CreditCardBrands brand { get; set; }}public class CreditCardBrandBins{ [XmlAttribute("value")] public string bin { get; set; } [XmlAttribute("enabled")] public bool enabled { get; set; }}\[/code\]I want to deserialize this xml into an array of Brands, each brand having a property name(type) and an array of bins(only the enabled ones) associated to them, so I can put it in memory at my system on startup.
 
Back
Top