_ Public Class SimplePerson Implements ISerializable Private m_name As String = "未設定" Private m_address As String = "未設定" Public Overridable Sub GetObjectData(ByVal info As SerializationInfo, ByVal context As StreamingContext) Implements ISerializable.GetObjectData info.AddValue("Name", m_name) info.AddValue("Address", m_address) End Sub Public Sub New() End Sub Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) m_name = info.GetString("Name") m_address = info.GetString("Address") End Sub Public Property Name() As String Get Return m_name End Get Set(ByVal Value As String) m_name = Value End Set End Property Public ReadOnly Property Address() As String Get Return m_address End Get End Property End Class _ Public Class Person Inherits SimplePerson Public Overrides Sub GetObjectData(ByVal info As SerializationInfo, ByVal context As StreamingContext) MyBase.GetObjectData(info, context) info.AddValue("Age", Age) End Sub Public Sub New() End Sub Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) MyBase.New(info, context) Age = info.GetInt32("Age") End Sub Public Age As Integer = 0 Private _temporaryID As String = "未設定" Public Sub SetTemporaryID(ByVal temporaryID As String) _temporaryID = temporaryID End Sub Public Sub Dump() System.Diagnostics.Trace.WriteLine(Name) System.Diagnostics.Trace.WriteLine(Address) System.Diagnostics.Trace.WriteLine(Age) System.Diagnostics.Trace.WriteLine(_temporaryID) End Sub End Class