Making events nonserializable

  • Thread starter Thread starter Brian Strelioff
  • Start date Start date
B

Brian Strelioff

I want to serialize an object space, except for current event handlers and
some other fields. While I can flag most fields as non-serialized, this
attribute does not seem to be applicable to event fields. Has anyone
developed a good way to do this?
 
Brian,
You apply the attribute to the Event, with the Field modifier, something
like:

[Serializable]
public class Class1
{
[field: NonSerialized]
public event EventHandler MyEvent;
}

Hope this helps
Jay
 
Back
Top