我有一个静态类,保存了一些信息。
当我刷新页面时,我希望SampleDataCache保留其数据。是否有简单的方法可以实现这一点?
public static class SampleDataCache
{
private static Dictionary<string,SampleData> cacheDict = new Dictionary<string,object>()
public static Get(string key)
{
if(!cacheDict.Contains[key])
cacheDict.Add(key,new SampleData());
return cacheDict[key];
}
}
当我刷新页面时,我希望SampleDataCache保留其数据。是否有简单的方法可以实现这一点?
Application
类的ApplicationLifetimeObjects
属性怎么样?为什么要去隔离存储呢? - bleepzter