Created
February 11, 2012 10:12
-
-
Save soltys/1798415 to your computer and use it in GitHub Desktop.
IsolatedStorageHelpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Soltys.Library.WindowsPhone | |
{ | |
public static class IsolatedStorageHelpers | |
{ | |
public static void SetValue<T>(this IsolatedStorageSettings storage,string key, T value) | |
{ | |
if (storage.Contains(key)) | |
{ | |
storage[key] = value; | |
} | |
else | |
{ | |
storage.Add(key, value); | |
} | |
} | |
public static T GetValueOrDefault<T>(this IsolatedStorageSettings storage,string key) | |
{ | |
if (storage.Contains(key)) | |
{ | |
return (T)storage[key]; | |
} | |
else | |
{ | |
return default(T); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment