Reputation: 499
I have key-value IsolatedStorage in my app, it contain 4 vars: 2 doubles, 1 bool and 1 ObservableCollection of classes objects. When I set ObservableCollection to settings and save it like this
settings["PlaceMarks"] = PlaceMarks;
it overwrites my bool var and on next start I got "key not found" exception
if I write to this settings something like string or number
settings["PlaceMarks"] = "string";
All is ok. My collection have only three instance of simple classes. So here is my question why my value disappears? May be it some limitations of IsolatedStorageSettings I didn't know
Upvotes: 2
Views: 520
Reputation: 7233
Only serializable objects (not the case of ObservableCollection) can be saved in the IsolatedStorageSettings.
Objects are serialized using the DataContractSerializer before saving the IsolatedStorageSettings.
https://stackoverflow.com/a/7417049/358596
Upvotes: 1
Reputation: 3046
have you marked those classes that are in Observeable Collection as Serializeable ?
ObservableCollection itself is not marked as serializeable. http://msdn.microsoft.com/en-us/library/ms668604(v=vs.95).aspx
I would suggest you try using a List instead
Upvotes: 3