Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • They'd be a better use case for weak references if there were a delegate type which would not keep the target alive, but would invalidate itself if the target were collected, and if Delegate.Combine knew enough about this delegate type to skip invalidated instances when combining delegates. Otherwise the .net event pattern has no good remedy for a scenario where many short-lived objects are created, subscribed to events from long-lived objects, and abandoned. Commented Dec 11, 2011 at 17:40
  • 2
    @supercat: Well, this isn't a question about .Net, or about any other platform or language - it's just about places where weak-references could be useful. Ironically, the project I was working on was in C++ (no event model), and it involved both reference counting and event handlers! Commented Jan 16, 2012 at 19:26
  • Why not just unsubscribe? Wouldn't it remove at least one reference and shrink the queue? Commented Aug 28, 2020 at 8:43