Esempio n. 1
0
        private static byte[] MessagePackS <T>(T obj, MsgPack.Serialization.MessagePackSerializer <T> serializer)
        {
            using (var mem = new MemoryStream())
            {
                serializer.Pack(mem, obj);

                return(mem.ToArray());
            }
        }
Esempio n. 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);
            }
        }