Serializing and Events
-
I have a serializable object which contains some events. I do not want the events serialized because they are oftne watched by non-serializable classes. When I try an add Nonserializable() to the events I get a compile error saying that attribute can be added to fields only. How can I avoid seralizing those events? Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n
-
I have a serializable object which contains some events. I do not want the events serialized because they are oftne watched by non-serializable classes. When I try an add Nonserializable() to the events I get a compile error saying that attribute can be added to fields only. How can I avoid seralizing those events? Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n
The C# compiler is tricking u a bit here: events get expanded to: private event public event {add; remove;} Thus setup your events as shown above and place the NonSerializable attribute on the private field HTH :) leppie::AllocCPArticle("Zee blog");
Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it. -
The C# compiler is tricking u a bit here: events get expanded to: private event public event {add; remove;} Thus setup your events as shown above and place the NonSerializable attribute on the private field HTH :) leppie::AllocCPArticle("Zee blog");
Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.Ah. Thanks for the Info. I had another solution to the problem in the intermin. I created an inner class to house the events and the event raising functions. I then exposed the events through properties (as you've shown above). Then I marked the member variable of the class that held the events as nonserializable() Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n