Example #1
0
        public void Add(HashtableElement el)
        {
            WeekReferenceWithHash hash = new WeekReferenceWithHash(this, el);

            this.hashtable.Add(hash, hash);
            this.EmptyRemoveQueue();
        }
Example #2
0
        public HashtableElement FindExistingOrAddToCache()
        {
            HashtableElement element = this.parentCollection.Find(this);

            if (element != null)
            {
                return(element);
            }
            this.parentCollection.Add(this);
            this.isInCache = true;
            return(this);
        }
Example #3
0
        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);
            }
        }
Example #4
0
 public WeekReferenceWithHash(WeakHashtable parent, HashtableElement target) : base(target)
 {
     this.parent = parent;
     this.hash   = target.GetHashCode();
 }