Serialization problem
-
[Serializable] Class A { public event Handler OnChange; public A() { this.OnChange += new Handler(this.Save); } public void Save() { filestream.Save(Serialize(this)); // Saves to file } } class B { A myA; public B() { myA = new A(); /* do stuff to myA that triggers OnChange() *E* - error - cannot serialize class of type B. } }
why doesn't it serialize myA, but it tries to serialize B ? THANKS ALOOOOT to the one\s who help me solve this. NaNg. -
[Serializable] Class A { public event Handler OnChange; public A() { this.OnChange += new Handler(this.Save); } public void Save() { filestream.Save(Serialize(this)); // Saves to file } } class B { A myA; public B() { myA = new A(); /* do stuff to myA that triggers OnChange() *E* - error - cannot serialize class of type B. } }
why doesn't it serialize myA, but it tries to serialize B ? THANKS ALOOOOT to the one\s who help me solve this. NaNg.I don't see why that should happen, what is the 'stuff' that you do ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I don't see why that should happen, what is the 'stuff' that you do ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )