Data Versioning

The types that hold the data are always subject to the .NET rules of versioning,[4] but that doesn't really help you when it comes to reading and writing old versions of the data using new versions of the object. One way to support versioned data formats is to write a version ID into the stream as part of a custom implementation of ISerializable:

[4] The details of .NET type versioning are covered in Essential .NET (Addison-Wesley, 2003), by Don Box, with Chris Sells.

 <Serializable()> _ Class MyData Implements ISerializable Dim s As String = "Wahoo!" Dim n As Integer = 6 Dim oldStrings As ArrayList = New ArrayList() ' v2.0 addition Shared currentVersion As String = "2.0" ... #Region Implementation of ISerializable Public Overrides ...

Get Windows Forms Programming in Visual Basic .NET 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.