Sample.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml.Serialization;
  7. namespace NewRockSdk.Tests
  8. {
  9. internal class Sample
  10. {
  11. }
  12. public class PurchaseOrder
  13. {
  14. [XmlArrayItem(DataType = "gMonth",
  15. ElementName = "MyMonths",
  16. Namespace = "http://www.cohowinery.com")]
  17. public string[] Months;
  18. [XmlArrayItem(typeof(Item)), XmlArrayItem(typeof(NewItem))]
  19. public Item[] Items;
  20. [XmlArray(IsNullable = true)]
  21. [XmlArrayItem(typeof(string)),
  22. XmlArrayItem(typeof(double)),
  23. XmlArrayItem(typeof(NewItem))]
  24. public object[] Things;
  25. }
  26. public class Item
  27. {
  28. public string ItemID;
  29. public Item() { }
  30. public Item(string id)
  31. {
  32. ItemID = id;
  33. }
  34. }
  35. public class NewItem : Item
  36. {
  37. public string Category;
  38. public NewItem() { }
  39. public NewItem(string id, string cat)
  40. {
  41. this.ItemID = id;
  42. Category = cat;
  43. }
  44. }
  45. public class Forest
  46. {
  47. /* Set the NestingLevel for each array. The first
  48. attribute (NestingLevel = 0) is optional. */
  49. [XmlArrayItem(ElementName = "tree", NestingLevel = 0)]
  50. [XmlArrayItem(ElementName = "branch", NestingLevel = 1)]
  51. [XmlArrayItem(ElementName = "leaf", NestingLevel = 2)]
  52. public string[][][] TreeArray;
  53. }
  54. }