Exemple #1
0
 public byte[] Serialize <T>(T value, long initialCapacity = 1024)
 {
     try
     {
         _stream.BeginWrite(initialCapacity);
         GetFormatter <T>().Write(value, _stream, this);
         return(_stream.Output.ToArray());
     }
     catch (MsgPackException e)
     {
         throw new MsgPackSerializationException(e.Message, _trace);
     }
     finally
     {
         _trace = string.Empty;
         _stream.Reset();
     }
 }