I am storing type related information in a dictionary, e.g.
Dictionary<Type, int> TypeInformation; TypeInformation[typeof(OneOfMyOwnClasses)] = 42;
Then I (binary) serialize the state of my application, including the above dictionary.
What happens to the type objects if I change
OneOfMyOwnClasses in code? Under which conditions do the type objects stay the same after deserialization? I.e. when will
if (TypeInformation[typeof(OneOfMyOwnClasses)] == 42) MessageBox.Show("Yahoo !!!");
give an affirmative result even after I deserialize the state of my app?
- Is a change of method bodies guaranteed to give the same type objects between different runs?
- Do changes of private method or field names change anything about the type objects?
- Changes of public method (or field) names?
- Change of namespace or assembly?
- Changes of class name itself? (supposedly not... ;-) )
Finally, given all that, are there any good reasons not to serialize type infos and is there a better yet more involved way (like creating GUID's and such)?