using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace NewRockSdk.Tests { internal class Sample { } public class PurchaseOrder { [XmlArrayItem(DataType = "gMonth", ElementName = "MyMonths", Namespace = "http://www.cohowinery.com")] public string[] Months; [XmlArrayItem(typeof(Item)), XmlArrayItem(typeof(NewItem))] public Item[] Items; [XmlArray(IsNullable = true)] [XmlArrayItem(typeof(string)), XmlArrayItem(typeof(double)), XmlArrayItem(typeof(NewItem))] public object[] Things; } public class Item { public string ItemID; public Item() { } public Item(string id) { ItemID = id; } } public class NewItem : Item { public string Category; public NewItem() { } public NewItem(string id, string cat) { this.ItemID = id; Category = cat; } } public class Forest { /* Set the NestingLevel for each array. The first attribute (NestingLevel = 0) is optional. */ [XmlArrayItem(ElementName = "tree", NestingLevel = 0)] [XmlArrayItem(ElementName = "branch", NestingLevel = 1)] [XmlArrayItem(ElementName = "leaf", NestingLevel = 2)] public string[][][] TreeArray; } }