2017-04-14 19 views
0

私が作成したセッションクラス用のカスタムシリアライザを書くのにMsgPack.Cliを使用しています。MsgPack.Cliを使用しているときに「古い」警告を修正する

警告: 'MessagePackSerializer.MessagePackSerializerは()' 廃止されました: 'を使用MessagePackSerializer(SerializationContext)の代わりに' this tutorial on the MsgPack.Cli github pageを使用してクラスを作成した後、私はこの警告を受けます

この警告を修正する変更はありません。私は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(); 
     } 
    } 
} 

感謝を。

答えて

0

エラーを修正しました。作業コードは以下のとおりです。私は正しい引数を持つ基本コンストラクタを呼び出すことはありませんでした。

public class SessionSerializer : MessagePackSerializer<Session> 
{ 
    public SessionSerializer(SerializationContext context) : base(context) { 
     throw new NotImplementedException(); 
    } 

    protected override void PackToCore(Packer packer, Session objectTree) 
    { 
     throw new NotImplementedException(); 
    } 

    protected override Session UnpackFromCore(Unpacker unpacker) 
    { 
     throw new NotImplementedException(); 
    } 
} 
関連する問題