Hello Mark.
Is it possible for me to serialize and deserialize a list directly? Like
this:
public static void SerializeT(T obj, string filename)
{
//Serialize
using (FileStream stream = File.Open(filename, FileMode.Create))
{
Hi Marc,
I had a similar question about the serialization of objects using protocol
buffers.
I prefer using a single .proto file for generation of C# and Java file, and
would like to know if my understanding of how to implement a generic list
of objects in the .proto file is right or not.
Thanks a lot for the explanation Marc.
I'm currently investigating some interop issues we're having and I'm
starting to realize that this might be the source of the problem.
[CollectionDataContract(Name = ItemList)]
public class ItemListTItem : ListItemTItem where TItem : class
...
where
Well, until I get around to re-implementing it for v2, GetProtoT will
just make a quiet apology. But to answer your question, consider an example
such as ItemListCustomer
ItemTItem could be (I can't remember how v1 implements this) something
like
message Item_Customer {
optional
Yes it does. Thanks.
Where can I read more about this disabling of list-handling and its effects?
On Thu, Jun 28, 2012 at 8:31 AM, Marc Gravell marc.grav...@gmail.comwrote:
Well, until I get around to re-implementing it for v2, GetProtoT will
just make a quiet apology. But to answer your
Firstly, I must say that I don't generally recommend inheriting from lists
in this context. The code, as an implementation detail, tries to detect
things that look like lists, and switches to treat it as repeated data.
Sometimes, pretty rarely, something *looks* like a list, but should be
treated
Hi Marc,
Could you elaborate on your note: (note: this is specific to protobuf-net,
not protocol buffers more widely)
What are the implications if communicating with non-protobuf-net targets?
(ie. java, python, ... applications)
Joel
On Wednesday, June 20, 2012 9:05:49 AM UTC-4, Marc
The data is of course compatible. A `ListFoo` is directly mappable to
.proto via for example:
message SomeOuterMessage {
repeated Foo items = 1;
}
In fact, for that reason, serializing a ListFoo will produce **exactly**
the same data on the wire as serializing:
(note: this is specific to protobuf-net, not protocol buffers more
widely), but yes: that (a generic list) would work fine, as long as the
property has been marked for serialization and given a number. There also
doesn't need to be a set accessor, although it can make full use of a
set - i.e. if