public void Add(HashtableElement el) { WeekReferenceWithHash hash = new WeekReferenceWithHash(this, el); this.hashtable.Add(hash, hash); this.EmptyRemoveQueue(); }
public HashtableElement FindExistingOrAddToCache() { HashtableElement element = this.parentCollection.Find(this); if (element != null) { return(element); } this.parentCollection.Add(this); this.isInCache = true; return(this); }
public HashtableElement Find(HashtableElement el) { WeekReferenceWithHash hash = new WeekReferenceWithHash(this, el); hash = (WeekReferenceWithHash)this.hashtable[(hash)]; this.EmptyRemoveQueue(); if (hash == null) { return(null); } try { return((HashtableElement)hash.Target); } catch (InvalidOperationException) { return(null); } }
public WeekReferenceWithHash(WeakHashtable parent, HashtableElement target) : base(target) { this.parent = parent; this.hash = target.GetHashCode(); }