Weak Events Without The Fuss With A ‘WeakReference’ Event Proxy

added by ButtonChrome
3/2/2010 2:01:50 AM

0 Kicks, 154 Views

We all get clobbered at least once by memory leaks in our shiny new applications. One of the main causes of this is when objects that are expected to be garbage collected are not because we have not (or are unable) to unsubscribe them from the event handlers of longer living (static) objects. The de-facto solution is to implement Microsoft’s ‘WeakEventManager’, but it takes a lot of coding, and adds another layer of complexity to your applications.