advertisement

Find Code  Advanced Search   

browse free vb code
Submit Code
ASP,  HTML, and XML
Database
Dates  and Math
Files  and Directories
Forms  and Controls
Lists,  Collections, and Arrays
Miscellaneous
Multimedia/Games
Office/VBA
Network/Internet
Registry
Screen/Graphics
String  Manipulation
System/API
Windows  2000/XP
VB.NET/ASP.NET



advertisement
Object Serialization in Visual Basic.NET: Demo

Author: Pramod Kumar Singh
Category: VB.NET/ASP.NET
Type: Modules
Difficulty: Advanced

Version Compatibility:  Visual Basic.NET  

More information: This sample demonstrates the runtime's ability to serialize an object in memory to disk. It also shows how to implement a linked list in VB.NET.

A singly-linked linked list is created, filled with values, and serialized to a file on disk. The list is then deserialized from the file on disk, restoring it to an object in memory. The elements within the list are then swapped multiple times.

Note that Option Strict is off in this module, because it uses casting of object while doing deserialization from disk to memory object.

To get this code to work, create a new Application in Visual Basic.Net. Add a module, copy the code below into that module. Then right-click the project name, select properties, and select Sub Main as the startup object.

Note that this illustrates binary serialization of an object. XML serialization is also possible; binary serialization makes it harder to read the object's property's outside of a .NET application, which can be an advantage or a disadvantage depending on your needs.

This demo, originally developed for VB.NET Beta 1, was modified to support VB.NET version 1.0 on 04/01/02.

This code has been viewed 88794 times.

Instructions: Copy the declarations and code below and paste directly into your VB project.


Declarations:

Code:

No Text Boxes

Sponsored Links


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers