예제 #1
0
        public void Add(HashtableElement el)
        {
            WeekReferenceWithHash hash1 = new WeekReferenceWithHash(this, el);

            this.hashtable.Add(hash1, hash1);
            this.EmptyRemoveQueue();
        }
예제 #2
0
        public HashtableElement FindExistingOrAddToCache()
        {
            HashtableElement element1 = this.parentCollection.Find(this);

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