Why not think about a different attack? In your collection hold the references as Weak References; when there are no strong references left the objects will be (may be) gc'd. Your collection will get a bit more complex - checking that a requested object is still valid - but not nearly as complicated as trying to count stongs refs.
Simon -----Original Message----- From: Christian Schmitz [mailto:csh@;GEDAS.DE] Sent: Thu 17 October 2002 14:07 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] count strong references hi, i would like to count the strong references to an object. in my framework there is one collection which holds strong references to objects. i would like to remove those objects which have no foreign strong references. that means when i remove these objects they are garbage collected by the dotnet framework. i dont want to extend the objects with special functionalities to provide this information. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.