.Net 序列化和反序列化
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.IO
Dim oTools As BinaryFormatter = New BinaryFormatter \\序列化要用到的类
Dim oStream As FileStream = New FileStream("Store Object Path", FileMode.OpenOrCreate) \\保存序列化后对象的流
Dim oMyObject As Object = Your Object \\设置自己的对象
oTools.Serialize(oStream, oMyObject) \\进行序列化
Dim oMySerialize As Object = oTools.Deserialize(oStream) \\进行反序列化并获取对象
简单地记录如何序列化和反序列化,供自己以后查阅,同时亦方便大家。