Steps: -
If your collection is large, then convert the ObservealCollection to an xml string and save it using the class IsolatedStorageSettingsas a Key-Value pair.
If this is not the case: - then you can do IsolatedStorageSettings directly as follows
IsolatedStorageSettings Store { get { return IsolatedStorageSettings.ApplicationSettings; } }
public T GetValue<T>(string key)
{
return (T)Store[key];
}
public void SetValue(string token, object value)
{
Store.Add(token, value);
Store.Save();
}
Usage: -
ObservableCollection<Note> objCollection = new ObservableCollection<Note>()
{
new Note(){Checkbool = false,Checkme = "sd"},
new Note(){Checkbool = false,Checkme = "sd1"},
new Note(){Checkbool = false,Checkme = "sd2"}
};
var isContainKey = Store.Contains("set")
SetValue("set", objCollection);
var value = GetValue<ObservableCollection<Note>>("set");
source
share