/*[NonSerialized()]*/ public event ListEvent ListChangedEx = null;

  • Thread starter Thread starter Alexander Muylaert
  • Start date Start date
A

Alexander Muylaert

How can I prevent an event of beïng serialized? it always give me the error

Attribute nonserialized is not valid on this declaration type ...

Kind regards

Alexander
 
Hi Alexander,

You can't apply this attribute directly to an event. You have to applied to
the even's back-up field

class Foo
{
[field: NonSerialized]
public event AnEventHandler AnEvent;
}
 
Back
Top