I have a (fairly simple?) xml file that was created (serialized I assume) by a C++ program. I am trying to deserialize it with my C# program so I can analyze it. I cannot arrange my C# classes so as to properly deserialize all the parts of the xml file. I assume that some C++ class layouts cannot be duplicated in C# and that is the problem. I have easily walked thru the tree and converted the xml data into my own class structure, but I am learning to use serialization and wanted to give that a try as it is cleaner. The basic problem is that I cannot arrange 10 "Stacks" of list boxes, one new "Deck" a list box and one "Completed" list box under 12 "CardStack" classes. They all have to fit under "CardStacks" and that fits under "CardTable". The list boxes all have identical structure so Deck is no different than Completed nor Stacks. The best I can do is to read all the "Stacks" but I cannot retrieve the "Deck" nor the "Completed" with below code
- [Serializable]
-
public class CardStacks
-
{
-
public CardStack[] CardStack = new CardStack[10];
-
public CardStack Deck = new CardStack();
-
public CardStack Completed = new CardStack();
-
public CardStacks()
-
{
-
for (int i = 0; i < 10; i++)
-
CardStack[i] = new CardStack();
-
}
-
}
-
[Serializable]
-
public class CardTable
-
{
-
public CardStacks CardStacks = new CardStacks();
-
}
Each of the above 3 "CardStack" are the identical class so I would have thought that there would be a total 12 of them in the resulting xml file. Instead there are only 10 and one each of "Deck" and "Completed" which are missing the wrapper "CardStack" about them as shown in the attachment "test.xml" Is it possible to wrap "Deck" and "Completed" with the class "CardStack" ? If so, that would solve my de-serialization problem.
Thanks for looking!