Is there a way to do WeakList (think WeakReference) in CLR?

Posted by Tim Lovell-Smith on Stack Overflow See other posts from Stack Overflow or by Tim Lovell-Smith
Published on 2010-05-14T20:41:39Z Indexed on 2010/05/14 20:44 UTC
Read the original article Hit count: 214

A List does not work in the way that I want. The way that I want is that WeakReferences are automatically removed from the list when the object they weakly reference is garbage collected.

ConditionalWeakTable does not do what I want either, because although its keys and values are weakly referenced and collectable, you cannot enumerate them at all.

© Stack Overflow or respective owner

Related posts about garbage-collection

Related posts about .NET