NonSerialized Events

Visual Basic 2015, as well as its predecessor, offers a feature known as NonSerialized Events. You can decorate an event with the NonSerialized attribute in custom serialization. A common scenario for applying this technique is when you work on classes that implement the INotifyPropertyChanged interface because it is more important to serialize data and not an event that just notifies the user interface of changes on data. The following code shows an example about NonSerialized events inside a class that implements INotifyPropertyChanged:

<Serializable()>Public Class Customer    Implements INotifyPropertyChanged    <NonSerialized()>    Public Event PropertyChanged(           sender As Object, ...

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.