Skip to Main Content
Visual Basic 2015 Unleashed
book

Visual Basic 2015 Unleashed

by Alessandro Del Sole
July 2015
Intermediate to advanced content levelIntermediate to advanced
1300 pages
87h 27m
English
Sams
Content preview from Visual Basic 2015 Unleashed

Binary Serialization

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Visual Basic 2015

Beginning Visual Basic 2015

Bryan Newsome

Publisher Resources

ISBN: 9780134196664Purchase book