我有一个实现Serializable
一个VB.NET单例类:不能调用序列化的单例类的实例序列化()在VB.NET
Imports System.IO
Imports System.Runtime.Serialization
<Serializable()> Public Class CoordinateHistory
Private Shared _thisInstance As CoordinateHistory
Private gpsHistory As Dictionary(Of DateTime, GpsTimeCoordinate)
Private gpsTimes As List(Of DateTime)
Public Event NewStatusInformation(statusInfo As String)
Protected Sub New()
gpsHistory = New Dictionary(Of DateTime, GpsTimeCoordinate)
gpsTimes = New List(Of DateTime)
End Sub
Public Shared Function getInstance() As CoordinateHistory
If _thisInstance Is Nothing Then
_thisInstance = New CoordinateHistory
End If
Return _thisInstance
End Function
Public Function getHistoryCount() As Integer
Return gpsHistory.Count
End Function
' bunch of other class functions below...
End Class
我的问题是,我不能真正称之为.Serialize()
在这个类的实例上,就像在线演示的所有示例一样。我究竟做错了什么?谢谢!
忘了问:你在使用什么序列化机制? –
我想要做二进制序列化,但如果更容易,XML就没问题了。 –