I am trying to serialize/deserialize my custom class which contains hashtable property using protobuf-net v2.
[ProtoContract]
public class MyClass
{
[ProtoMember(1)]
public Hashtable MyHashTable { get; set; }
}
When I call Serializer.Serialize(...) exception appears: No serializer defined for type: System.Collections.Hashtable
I try to modify:
[ProtoContract]
public class MyClass
{
[ProtoMember(1, DynamicType = true)]
public Hashtable MyHashTable { get; set; }
}
But I have another exception: Type is not expected, and no contract can be inferred: System.Collections.DictionaryEntry
Maybe someone know a way how I can serialize hashtable?
Thanks to all who helped me. Here is my solution. I know that this is not best way, but maybe for someone it acceptable.