Strong versus Weak Event Pattern

You need perhaps read the following to understood my question:

See: http://msdn2.microsoft.com/en-us/library/aa970850.aspx

In WPF there are situation for weak events. Not enough understanding when or how to prevent memory leak associated with events. Can I use the same pattern with my ordinary C# code, not related to WPF

Peca




Answer this question

Strong versus Weak Event Pattern

  • nature0276

    Yet more questions

    Can atached or depency properties introduce life-time extensions out of knowledge of user of sealed system classes How can you drop or make backtrack point(parent don't need to honor childs local request - can I do it layout or render level) One more stupid queston: Why C# don't support constructor inheritance After C# 3.0 you can make extension methods to basic intrisinct types but they have to be static. Why you can't make per instance extensions Something about inferred var type. I think that it's use don't shorten code - even omitting that type alltogether, the compiler must be smart enough to deduce from the context the right type used - you can call it anonymous or delegated type!

    Trying to be cute

    Peca



  • WXS123

    There's been some work on using WeakReference and creating weak delegates (http://blogs.msdn.com/greg_schechter/archive/2004/05/27/143605.aspx). But, I think it's generally unreliable. It's easier to simply unsubscribe your event your dispose methods.

  • Strong versus Weak Event Pattern