开发者

Cache CanExecute (or anything) in WPF?

开发者 https://www.devze.com 2023-03-25 04:05 出处:网络
The Cache object in System.Web is pretty freaking nice. I handle my CommandBinding.CanExecute sort of like this:

The Cache object in System.Web is pretty freaking nice.

I handle my CommandBinding.CanExecute sort of like this:

CommandBinding开发者_JS百科s[0].CanExecute += (s, e) =>
{
    e.CanExecute = NotInsignificantRoutine();
};

In my scenario, the return value of NotInsignificantRoutine() doesn't change inside a 5 second window. What would be the best way to cache in WPF? Import System.Web?


Ah, I didn't know about this; here:

The System.Runtime.Caching namespace is new in the .NET Framework 4. This namespace makes caching is available to all .NET Framework applications. In previous versions of the .NET Framework, caching was available only in the System.Web namespace and therefore required a dependency on ASP.NET classes.

http://msdn.microsoft.com/en-us/library/dd997362.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号