.Net Framework 3.5 中是否包含 ObjectCache 类?
如果没有,是否有替代方法将对象存储在缓存中(在 Windows 应用程序中不是 asp.net)?
有没有人有任何在线资源或代码片段来演示如何使用 ObjectCache 类?
最佳答案
Is the ObjectCache class included in .net framework 3.5
没有。
您仍然可以使用 ASP.NET cache在 WinForms 应用程序中,如果您引用 System.Web
程序集:
HttpRuntime.Cache["key"] = "value";
如果您想定义更细粒度的属性:
HttpRuntime.Cache.Add(
"key",
"value",
null,
DateTime.MaxValue,
TimeSpan.FromSeconds(3),
CacheItemPriority.High,
new CacheItemRemovedCallback(OnItemRemove)
);
关于c# - .net Windows 应用程序中的 ObjectCache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6758047/