SerializationException - Why?
I want to save a object(im my case a "Chart") to a file.
This is the code I have used:
BinaryFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream(fileSaver.FileName, FileMode.Create,
formatter.Serialize(stream, ((Chart)this.ActiveMdiChild) );
I have included the [Serializable]attribute to both the Chart-class and all classes used by chart.
As I try to save the file(formatter.Serialize(stream, ((Chart)this.ActiveMdiChild) ); ), this message occur:
An unhandled exception of type 'System.Runtime.Serialization.SerializationExcepti on' occurred in mscorlib.dll
Additional information: The type FFI.Gui.Chart in Assembly FFI, Version=1.0.1256.18215, Culture=neutral, PublicKeyToken=null is not marked as serializable.
Can someone help me?