So, deserializing is working however I have some xml like this:
<File>
<Stuff>stuff</Stuff>
<Devices>
<Device Type="1">
<Number>1</Number>
</Device>
<Device Type="2">
<Number>2</Number>
</Device>
</Devices>
</File>
When it gets to the array of devices... the first device is the only one that is populated into an object. Here are the classes:
XmlSerializer deserializer;
XmlRootAttribute xRoot = new XmlRootAttribute();
FileStream stream = new FileStream(CONFIG_PATH, FileMode.Open);
XmlReader reader = new XmlTextReader(stream);
// Details configuration area.
xRoot.ElementName = "File";
xRoot.IsNullable = true;
deserializer = new XmlSerializer(typeof(File), xRoot);
Configuration = (File)deserializer.Deserialize(reader);
[Serializable()]
[XmlRoot(ElementName = "File", IsNullable = true)]
public sealed class File
{
[XmlElement("Devices")]
public Devices Devices { get; set; }
}
// <summary>
/// Configuration device elements.
/// </summary>
[Serializable()]
[XmlRoot("Devices", IsNullable = true)]
public sealed class Devices
{
[XmlElement("Device")]
public DeviceElements[] DeviceElements { get; set; }
}
/// <summary>
/// Configuration Devices.
/// </summary>
[Serializable()]
[XmlRoot("Device", IsNullable = true)]
public sealed class DeviceElements
{
[XmlAttribute("Type")]
public string DeviceType { get; set; }
[XmlElement("Number")]
public int DeviceNumber { get; set; }
}
Again, only the first Device is populated, I've played with XmlArray And XmlArrayItem however neither of them were even giving me the first value. Any suggestions?