Exemplo n.º 1
0
 public static void Serialize <T>(T data, MemoryStream stream, [NotNull] MsgPackContext context)
 {
     using (var writer = new MsgPackMemoryStreamWriter(stream, false))
     {
         var converter = GetConverter <T>(context);
         converter.Write(data, writer);
     }
 }
Exemplo n.º 2
0
        public static byte[] Serialize <T>(T data, [NotNull] MsgPackContext context)
        {
            var memoryStream = new MemoryStream();

            using (var writer = new MsgPackMemoryStreamWriter(memoryStream))
            {
                var converter = GetConverter <T>(context);
                converter.Write(data, writer);
                return(memoryStream.ToArray());
            }
        }