【发布时间】:2017-04-14 02:25:52
【问题描述】:
我正在使用 MsgPack.Cli 为我创建的 Session 类编写自定义序列化程序。使用this tutorial on the MsgPack.Cli github page 创建类后,我收到以下警告:
警告:“MessagePackSerializer.MessagePackSerializer()”已过时:“请改用 MessagePackSerializer(SerializationContext)。”
我无法确定哪些更改可以解决此警告。我认为不需要 MessagePackSerializer 的知识来帮助我解决这个问题;我只是不明白警告的语法。
我的代码如下:
namespace Something_Networky
{
public class Session
{
private int _n;
public int n { get; }
public Session(int n)
{
this._n = n;
}
}
public class SessionSerializer : MessagePackSerializer<Session>
{
public SessionSerializer() : this(SerializationContext.Default) { }
public SessionSerializer(SerializationContext context) // Warning displayed on this line
{
}
protected override void PackToCore(Packer packer, Session value)
{
throw new NotImplementedException();
}
protected override Session UnpackFromCore(Unpacker unpacker)
{
throw new NotImplementedException();
}
}
}
感谢您的帮助。
【问题讨论】:
标签: c# .net compiler-warnings msgpack