public void Add(HashtableElement el) { WeekReferenceWithHash hash1 = new WeekReferenceWithHash(this, el); this.hashtable.Add(hash1, hash1); this.EmptyRemoveQueue(); }
public HashtableElement FindExistingOrAddToCache() { HashtableElement element1 = this.parentCollection.Find(this); if (element1 != null) { return(element1); } this.parentCollection.Add(this); this.isInCache = true; return(this); }
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); }
// Methods public WeekReferenceWithHash(WeakHashtable parent, HashtableElement target) : base(target) { this.parent = parent; this.hash = target.GetHashCode(); }