/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static class IsolatedStorageCacheManager<T> { public static void Store(string filename, T obj) { IsolatedStorageFile appStore = IsolatedStorageFile.GetUserStoreForApplication(); using (IsolatedStorageFileStream fileStream = appStore.OpenFile(filename, FileMode.Create)) { serializer.WriteObject(fileStream, obj); } } public static T Retrieve(string filename) { T obj = default(T); IsolatedStorageFile appStore = IsolatedStorageFile.GetUserStoreForApplication(); if (appStore.FileExists(filename)) { using (IsolatedStorageFileStream fileStream = appStore.OpenFile(filename, FileMode.Open)) { obj = (T)serializer.ReadObject(fileStream); } } return obj; } }