I’ve done a little of this in the past, and I’m about to do it today. Each time I have to look it up, so in hopes of finding it a little quicker or maybe remembering how this time, I’ll post it here.
From: MSDN – Custom Serialization
Public Class MyObject
Implements ISerializable
Public n1 As Integer
Public n2 As Integer
Public str As String
Public Sub New()
End Sub
Protected Sub New(ByVal info As SerializationInfo, _
ByVal context As StreamingContext)
n1 = info.GetInt32("i")
n2 = info.GetInt32("j")
str = info.GetString("k")
End Sub 'New
Public Overridable Sub GetObjectData(ByVal info As _
SerializationInfo, ByVal context As StreamingContext)
info.AddValue("i", n1)
info.AddValue("j", n2)
info.AddValue("k", str)
End Sub
End Class