Actually protobuf-net will handle IDictionary<TKey,TValue> *fine* as long as both TKey and TValue make sense to protobuf-net, and it treats them (exactly like in your example) as fields 1 and 2 respectively. I suspect you could also use anything implementing IEnumerable<KeyValuePair<TKey,TValue>> under the same conditions. In v2 I add support for non-generic collections, so you could probably handle things like StringDictionary right off the bat (although I'll be honest - I haven't specifically tested with StringDictionary)
Marc 2011/1/31 Miguel Muñoz <swingguy1...@yahoo.com> > The way we serialize a map<String, String> is this: > > 1) We define a MappedPair message like this: > > message MappedPair { > string key=1; > string value=2; > } > > 2) Then we define a MappedPairList message, that's just a repeated > MappedPair. > > 3) Then we iterate through our Map<String, String> to convert it to a > MappedPairList, and serialize that. > > Since you're mapping serialized objects, your task is a bit more > difficult, but I'm sure there's a way to do it. > > -- Miguel Munoz > > > On Jan 29, 8:03 am, NYCBrit <richard...@gmail.com> wrote: > > Is it possible to serialize a Dictionary<string,object> where all the > > objects are pointing to classes marked up with [ProtoContract]? > > -- > 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<protobuf%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- Regards, Marc -- 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.