Philipp Schumann <(E-Mail Removed)> wrote:
> I know---I should have been more clear: what is in the Hashtable are
> WeakReferences (I want to prevent the Hashtable from preventing garbage
> collections of the objects it is referencing). So I want to return the
> GetHashTable of a weakReference.Target, which may be null...
So the key itself isn't null, it's just a property of the key which is
null. In that case you could return whatever you want. There's a
difficulty here though - that hashcode function effectively changes
over time. If you put a weak reference in the hashtable as a key, then
if the object the weak reference refers to is garbage collected, you
won't be able to find that key again, because the hashcode you're going
to return has changed.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too