July 2015
Intermediate to advanced
1300 pages
87h 27m
English
The following example shows how you can serialize a typed collection of strings into a file on disk using the BinaryFormatter class:
Dim stringSeries As New List(Of String) From {"Serialization", "demo", "with VB"}Dim targetFile As New _ FileStream("C:\temp\SerializedData.dat", FileMode.Create)Dim formatter As New BinaryFormatterformatter.Serialize(targetFile, stringSeries)targetFile.Close()formatter = Nothing
Note
The previous code example requires Imports System.IO and Imports System.Runtime.Serialization.Formatters.Binary directives.
The code creates a new file named SerializedData.dat and puts the result of the binary serialization ...