I have serveral classes derived from Form and UserControl. These classes get their data from a set of classes I wrote which are declared as being serialized.
When I try and save the data for the serialized classes, I get an error saying one of my UserControl derived classes is not marked as serializable (see attached for message). Indeed, the class that the dialog is identifying is not marked as serializable, and I dont want it to be serialized.
I figured out that my use of an event object in my data class is causing the problem. If I comment out the event declaration below, my application works. So my data class is trying to serialize the event object. But if I try and use [NonSerialized] in front of the event declaration, I get a compiler error saying [NonSerialized] is only valid on fields.
public delegate void DataChanged( Object source, COSPData data );
private event DataChanged m_notifyDataChangedClient;
So what can I do to prevent my data class from trying to serialize the object associated with the event? If I cannot mark it as [NonSerialized], then wha else can I do?
thanks
Bryan
When I try and save the data for the serialized classes, I get an error saying one of my UserControl derived classes is not marked as serializable (see attached for message). Indeed, the class that the dialog is identifying is not marked as serializable, and I dont want it to be serialized.
I figured out that my use of an event object in my data class is causing the problem. If I comment out the event declaration below, my application works. So my data class is trying to serialize the event object. But if I try and use [NonSerialized] in front of the event declaration, I get a compiler error saying [NonSerialized] is only valid on fields.
public delegate void DataChanged( Object source, COSPData data );
private event DataChanged m_notifyDataChangedClient;
So what can I do to prevent my data class from trying to serialize the object associated with the event? If I cannot mark it as [NonSerialized], then wha else can I do?
thanks
Bryan
Attachments
Last edited: