我正在尝试反序列化作为集合的对象。集合中包含的类是基类的继承类。
Public MustInherit Class EntityBase
Protected Sub New()
Initialize()
End Sub
End Class
Partial Public Class [BarEntity]
Inherits EntityBase
Public Sub New()
MyBase.New()
End Sub
End Class
在这种情况下,集合包含BarEntity类。但是当时我正在调用protobuf-net中的反序列化器,就像这样
Dim byteafter() As Byte = Convert.FromBase64String(CType(oWSResult.Obj, String))
Dim ms As New MemoryStream(byteafter)
myList = Serializer.Deserialize(Of BarEntityCollection)(ms)
抛出这个没有为EntityBase找到无参数构造函数
此代码正在Compact Framework 3.5应用程序中执行。
任何帮助将不胜感激。谢谢。