Hi,
I am serializing a custom class holding some data for my project.
This data internally contains a class which contains an event
public delegate void MemberModifiedEventHandler(object sender,
MemberModifiedEventArgs e);
/// <summary>
/// Occurs on modification in a group.
/// </summary>
public event MemberModifiedEventHandler OnMembersModified;
This sender brings in a CutomPage derived from
System.Windows.Forms.UserControl.
I do not need to serialize this class as it contains only UI and has
got nothing to be saved and serialized.
But when i serialize the data it gives the error "CutomPage is not
marked as serializable".
How can i come across this problem without serializing this page.
NonSerializable attribute does not work for events and classes.
How can i serialize my data without serializing these usercontrol
clases.
Waiting for a kind reply.
Thanks & Regards
Nirdesh Dabas
nirdesh_12@yahoo.com
Nicholas Paldino [.NET/C# MVP] - 27 Aug 2007 15:15 GMT
Nirdesh,
Have you tried applying it to the field on the event, like so?
[field:NonSerializable]
public event EventHandler MyEvent;
That should work.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Hi,
>
[quoted text clipped - 36 lines]
>
> nirdesh_12@yahoo.com