简体   繁体   中英

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. 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. 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 ).

The implementation you are after is WeakEventListener found in the Common folder of he main Controls.Toolkit project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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