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

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
 
S

Stoitcho Goutsev \(100\) [C# MVP]

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top