I have a class with some static methods. Some variables are public. I define a static object like this:
public static SoundClass Sounds;
In the constructor I do this:
SoundClass Sounds = new SoundClass();
Later I have set some variables like this:
Sounds.SoundOn = true;
When I push a button I would like to serialize this into an XMLfile. I have understood that you can't serialize static objects so I tried this:
SoundClass s = new SoundClass();
s = Sounds;
SerializeFunction(s);
The problem is that:
s = Sounds don't work correctly. Sounds is undefined. I thought that I could come around this by copying the static object this way to this new object. The SerializeFunction work when I don't copy it. Is there anyway to copy and serialize this static object?
thanks!
--- neteject.com - Internet Solutions ---
public static SoundClass Sounds;
In the constructor I do this:
SoundClass Sounds = new SoundClass();
Later I have set some variables like this:
Sounds.SoundOn = true;
When I push a button I would like to serialize this into an XMLfile. I have understood that you can't serialize static objects so I tried this:
SoundClass s = new SoundClass();
s = Sounds;
SerializeFunction(s);
The problem is that:
s = Sounds don't work correctly. Sounds is undefined. I thought that I could come around this by copying the static object this way to this new object. The SerializeFunction work when I don't copy it. Is there anyway to copy and serialize this static object?
thanks!
--- neteject.com - Internet Solutions ---