public void Add(HashtableElement el) { WeekReferenceWithHash hash1 = new WeekReferenceWithHash(this, el); this.hashtable.Add(hash1, hash1); this.EmptyRemoveQueue(); }
public HashtableElement Find(HashtableElement el) { HashtableElement element1; WeekReferenceWithHash hash1 = new WeekReferenceWithHash(this, el); hash1 = (WeekReferenceWithHash)this.hashtable[hash1]; this.EmptyRemoveQueue(); if (hash1 == null) { return(null); } try { element1 = (HashtableElement)hash1.Target; } catch (InvalidOperationException) { element1 = null; } return(element1); }
public override bool Equals(object obj) { object obj1; object obj2; WeekReferenceWithHash hash1 = (WeekReferenceWithHash)obj; if (object.ReferenceEquals(this, hash1)) { return(true); } try { obj1 = this.Target; } catch (InvalidOperationException) { obj1 = null; } if (obj1 == null) { this.parent.AddForRemoval(this); return(false); } try { obj2 = hash1.Target; } catch (InvalidOperationException) { obj2 = null; } if (obj2 == null) { this.parent.AddForRemoval(hash1); return(false); } return(obj1.Equals(obj2)); }
internal void AddForRemoval(WeekReferenceWithHash weakRef) { this.removeQueue.Enqueue(weakRef); }