i'm new to protocol buffers and I am using protobuf-net for VS2010. from what i'm reading here Dictionary in protocol buffers, it doesn't seem that protobuf can serialize a dictionary with object types as values. but here on his site i read this:
Notes on types
supported:
custom classes that: are marked as data-contract have a parameterless constructor for Silverlight: are public many common primitives etc single dimension arrays: T[] List / IList Dictionary / IDictionary any type which implements IEnumerable and has an Add(T) method The code assumes that types will be mutable around the elected members. Accordingly, custom structs are not supported, since they should be immutable.
which seems like it is supported.
I can successfully compile a List of objects like so:
message ValuesObject {
optional int32 SomeVal = 1;
repeated SomeClass ListOfSomeClassTypes = 2;
}
This works fine for a List<SomeClass>
. Why cannot I serialize using protobuf-net a Dictionary<int, SomeClass>
? What would the message look like to serialize a Dictionary<int, SomeClass>
?