Binary Serialization

The following example shows how you can serialize a typed collection of strings into a file on disk using the BinaryFormatter class:

image

Note

The above code example requires Imports System.IO and Imports System.Runtime.Serialization.Formatters.Binary directives.

The code simply creates a new file named SerializedData.Dat and puts the result of the binary serialization in the file. If you examine the content of the file with the Windows Notepad, you can obtain a result similar to what is shown in Figure 43.1.

Figure 43.1 Examining the result of the serialization process.

You don’t effectively need to know how your objects are ...

Get Visual Basic® 2010 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.