Serialize a List of my class to Windows Phone Isolated Storage

Daz

New Member
I'm using the .net XmlSerializer class to serialize the state of my game into isolated storage.
This allows me to avoid mucking up my code with an immense number of attributes.I get an exception whenever I try to serialize a list of my structs of public data:
"circular reference was detected while serializing an object of type GameState_test.Planet" How do I fix this? I've researched a ton of answers but none pertain to WP7.\[code\]public class Hazard { public Planet CurrentPlanet;} //reference to the planet its onpublic struct Inventory{ public Inventory(int coins = 0, int arrows = 0) { Coins = coins; Arrows = arrows; } public int Coins; public int Arrows;}public class Planet { public Inventory Inventory; internal readonly int Index; internal readonly List<int> Connections; public Hazard pHazard; //hazard currently on planet }\[/code\]
 
Back
Top