How to serializing a class containing queues?



I have a class called GamePrototype that I would like to serialize, containing the following members:



public class GamePrototype
{
private string mPath;
private bool[] isHumanPlayer;
private Queue<CardPrototype> mKickStack;
private Queue<CardPrototype> mMainDeck;
private Queue<CardPrototype> mStarterDecks;
private Queue<CardPrototype> mSuperVillianStack;
private Queue<CardPrototype> mWeaknessStack;
private Queue<PlayerHero> mPlayableHeroes;
public Queue<CardPrototype>[] mStartingLocations;
}


I have getters and setters for most if not all of them, but I'm getting an error asking for a "default accessor" in my queues. I've gathered that in the current situation, this class is not serializable because of the queues, but my questions are:


Is there a way to easily transfer these queues into Lists just for serialization? Will I need to do this for all classes these members belong to as well? For example, Card prototype contains one queue and one stack.


Thank you very much for any help you might give me.


No comments:

Post a Comment