简体   繁体   English

什么是对银光的弱事件的良好实施?

[英]What's a good implementation of weak events for silverlight?

I'm after a good implementation of the weak event patterns for Silverlight to avoid memory leaks. 我正在为Silverlight很好地实现弱事件模式以避免内存泄漏。 There seem to be a few implementations out there but the code is not trivial and it's hard to know which one is correct. 似乎有一些实现,但代码不是微不足道的,很难知道哪一个是正确的。 I can't find any official recommendation from Microsoft. 我找不到微软的任何官方推荐。

I'm after a simple syntax if possible. 如果可能的话,我会使用简单的语法。

Cheers. 干杯。

Install a copy of the Silverlight Toolkit which comes with source code zipped up. 安装Silverlight Toolkit的副本,该副本附带压缩的源代码。 In there you will find the pattern of weak events that you might consider the "Microsoft" recommendation. 在那里你会发现你可能会认为是“微软”推荐的弱事件模式。 (You can also fetch the latest source from codeplex ). (您也可以从codeplex获取最新的源代码)。

The implementation you are after is WeakEventListener found in the Common folder of he main Controls.Toolkit project. 您正在实现的实现是WeakEventListener它位于主要Controls.Toolkit项目的Common文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM