Dictionary not deserializing
- by Shadow
I'm having a problem where one Dictionary in my project is either not serializing or not deserializing. After deserializing, the data I serialized is simply not in the object.
Here's the relevant snip of the class being serialized:
class Person : ISerializable {
private Dictionary<Relation,List<int>> Relationships = new Dictionary<Relation,List<int>>();
public Person(SerializationInfo info, StreamingContext context) {
this.Relationships = (Dictionary<Relation, List<int>>) info.GetValue("Relationships", typeof(Dictionary<Relation, List<int>>));
}
public void GetObjectData(SerializationInfo info, StreamingContext context) {
info.AddValue("Relationships", this.Relationships);
}
}
Note, this is binary serialization. Everything else in the project serializes and deserialzes correctly.