these are the classes I'm working with currently.
  public class Monster  {      [XmlAttribute("name")]      public string Name;      public int Mana;      public int Health;      public List<Drop> Drops;      }  public class Drop  {      public string DropInfo;  }      This is the XML:
  <Monster name="TestMonster1">    <Health>5</Health>    <Mana>2</Mana>    <Drops>      <Drop>124 20 40</Drop>      <Drop>140 15 25</Drop>      <Drop>155 10 15</Drop>    </Drops>  </Monster>      What I want to do is add each of the XML into the Drop List. I've tried different combinations of XmlArray, XmlArrayItem and XmlElement but none of them have worked.
Right now the Drop class only has a string, but it will have more as I need to process that string, that's why the List isn't just an array of strings.
Is it possible to do? The only thing I managed to do was to get the List to have 3 items which is correct, but the string always was null.
 
No comments:
Post a Comment