private static byte[] MessagePackS <T>(T obj, MsgPack.Serialization.MessagePackSerializer <T> serializer) { using (var mem = new MemoryStream()) { serializer.Pack(mem, obj); return(mem.ToArray()); } }
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); } }