Use this class for Isolated storage
public class ApplicationSettings
{
///
/// method to get value of given key
///
///
///
///
public static T GetKeyValue(string key)
{
try
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
return (T)IsolatedStorageSettings.ApplicationSettings[key];
else
return default(T);
}
catch (Exception) { return default(T); }
}
///
/// method to set value of key
///
///
///
///
public static void SetKeyValue(string key, T value)
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
IsolatedStorageSettings.ApplicationSettings[key] = value;
else
IsolatedStorageSettings.ApplicationSettings.Add(key, value);
IsolatedStorageSettings.ApplicationSettings.Save();
}
///
/// method to remove key from isolated storage
///
///
public static void RemoveKey(string key)
{
try
{
IsolatedStorageSettings.ApplicationSettings.Remove(key);
}
catch
{
}
}
///
/// method to check when a key exists in isolated storage
///
///
///
public static bool HasKey(string key)
{
try
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(key))
return true;
else
return false;
}
catch (Exception) { return false; }
}
}
then store data as
ApplicationSettings.SetKeyValue("key", value);
retrieve
var aaa=ApplicationSettings.GetKeyValue("key");