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

            this.hashtable.Add(hash, hash);
            this.EmptyRemoveQueue();
        }
Exemple #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);
        }
Exemple #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);
            }
        }
Exemple #4
0
 public WeekReferenceWithHash(WeakHashtable parent, HashtableElement target) : base(target)
 {
     this.parent = parent;
     this.hash   = target.GetHashCode();
 }