Well, this code certainly passes the unit test of comparing before and
after protobufs. But the string still fails to be recognized as a
valid protobuf object on the server.

Any ideas?

Thanks

        private string Serialize(OrderProto proto)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                Serializer.Serialize<OrderProto>(stream, proto);
                byte[] data = stream.ToArray();
                char[] chars = new char[stream.Length];
                for (int i = 0; i < data.Length; i++)
                    chars[i] = (char) data[i];
                return new string(chars);
            }
        }

        private OrderProto Deserialize(string protoStr)
        {
            char[] chars = protoStr.ToCharArray();
            byte[] data = new byte[chars.Length];
            for (int i = 0; i < chars.Length; i++)
                data[i] = (byte)chars[i];
            using (MemoryStream stream = new MemoryStream(data))
                return Serializer.Deserialize<OrderProto>(stream);
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to