Exemple #1
0
 private static T MessagePackD <T>(MsgPack.Serialization.MessagePackSerializer <T> serializer, byte[] bytes)
 {
     using (var mem = new MemoryStream(bytes))
     {
         return(serializer.Unpack(mem));
     }
 }
Exemple #2
0
        private static void MessagePack <T>(T obj, MsgPack.Serialization.MessagePackSerializer <T> serializer)
        {
            T copy;

            using (var mem = new MemoryStream())
            {
                serializer.Pack(mem, obj);

                mem.Seek(0, SeekOrigin.Begin);
                copy = serializer.Unpack(mem);
            }
        }