Your problem.

Not possible.

(a) the objects do not KNOW how many string references thre are. The
Garbage collector of the :NET Framework does not work with reference
counting, so this data can not be available. The algorythm used is a
mark and sweep type - you are out of luck here.

You will HAVE to use weak references for your collection. Thats the way
it is designed.

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

-----Original Message-----
From: Christian Schmitz [mailto:csh@;GEDAS.DE] 
Sent: Donnerstag, 17. Oktober 2002 15: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.

thanks for your help!
Christian

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to