Esempio n. 1
0
        public void Add(HashtableElement el)
        {
            WeekReferenceWithHash hash = new WeekReferenceWithHash(this, el);

            this.hashtable.Add(hash, hash);
            this.EmptyRemoveQueue();
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 internal void AddForRemoval(WeekReferenceWithHash weakRef)
 {
     this.removeQueue.Enqueue(weakRef);
 }