我有序列化的基类。
[ProtoContract]
public class Web2PdfEntity
{
[ProtoMember(1)]
public string Title { get; set; }
[ProtoMember(2)]
public string CUrl { get; set; }
}
我想将 Web2PdfEntity 类反序列化为从 Web2PdfEntity 继承的 Web2PdfServer。
public class Web2PdfServer : Web2PdfEntity
{
public void MyServerMethod {}
public void MyServerMethod2{}
}
我尝试使用下面的代码来反序列化类,不幸的是没有设置属性。
var web2Pdf = Serializer.Deserialize<Web2PdfServer>("c:\Web2PdfEntity-class-to-serialize-file.bin");
web2Pdf.Title //<- not deserialized
web2Pdf.CURL //<- not deserialized