public void Add(HashtableElement el) { WeekReferenceWithHash hash = new WeekReferenceWithHash(this, el); this.hashtable.Add(hash, hash); this.EmptyRemoveQueue(); }
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 override bool Equals(object obj) { object obj2; object obj3; WeekReferenceWithHash weakRef = (WeekReferenceWithHash)obj; if (object.ReferenceEquals(this, weakRef)) { return(true); } try { obj2 = this.Target; } catch (InvalidOperationException) { obj2 = null; } if (obj2 == null) { this.parent.AddForRemoval(this); return(false); } try { obj3 = weakRef.Target; } catch (InvalidOperationException) { obj3 = null; } if (obj3 == null) { this.parent.AddForRemoval(weakRef); return(false); } return(obj2.Equals(obj3)); }
internal void AddForRemoval(WeekReferenceWithHash weakRef) { this.removeQueue.Enqueue(weakRef); }