Serialization Events

The serialization process raises four events, which are summarized in Table 39.1.

Image

TABLE 39.1 Serialization Events

Serialization events are handled differently than classic events are. There is an attribute for each event that you can handle as follows:

'Invoke this method before'serialization begins<OnSerializing()>Private Sub FirstMethod()End Sub'Invoke this method after'serialization completes<OnSerialized()>Private Sub SecondMethod()End Sub'Invoke this method before'deserialization begins<OnDeserializing()>Private Sub ThirdMethod()End Sub'Invoke this method after'deserialization completes<OnDeserialized()>Private Sub ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.