Exemple #1
0
 // Token: 0x06008A25 RID: 35365 RVA: 0x00256A88 File Offset: 0x00254C88
 bool IEqualityComparer.Equals(object x, object y)
 {
     if (x == null)
     {
         return(y == null);
     }
     if (y == null || x.GetHashCode() != y.GetHashCode())
     {
         return(false);
     }
     WeakHashtable.EqualityWeakReference equalityWeakReference  = x as WeakHashtable.EqualityWeakReference;
     WeakHashtable.EqualityWeakReference equalityWeakReference2 = y as WeakHashtable.EqualityWeakReference;
     if (equalityWeakReference != null && equalityWeakReference2 != null && !equalityWeakReference2.IsAlive && !equalityWeakReference.IsAlive)
     {
         return(true);
     }
     if (equalityWeakReference != null)
     {
         x = equalityWeakReference.Target;
     }
     if (equalityWeakReference2 != null)
     {
         y = equalityWeakReference2.Target;
     }
     return(x == y);
 }
Exemple #2
0
 // Token: 0x06006566 RID: 25958 RVA: 0x001C6F60 File Offset: 0x001C5160
 public object UnwrapKey(object key)
 {
     WeakHashtable.EqualityWeakReference equalityWeakReference = key as WeakHashtable.EqualityWeakReference;
     if (equalityWeakReference == null)
     {
         return(null);
     }
     return(equalityWeakReference.Target);
 }
Exemple #3
0
        // Token: 0x06006567 RID: 25959 RVA: 0x001C6F80 File Offset: 0x001C5180
        private void ScavengeKeys()
        {
            int count = this.Count;

            if (count == 0)
            {
                return;
            }
            if (this._lastHashCount == 0)
            {
                this._lastHashCount = count;
                return;
            }
            long totalMemory = GC.GetTotalMemory(false);

            if (this._lastGlobalMem == 0L)
            {
                this._lastGlobalMem = totalMemory;
                return;
            }
            float num  = (float)(totalMemory - this._lastGlobalMem) / (float)this._lastGlobalMem;
            float num2 = (float)(count - this._lastHashCount) / (float)this._lastHashCount;

            if (num < 0f && num2 >= 0f)
            {
                ArrayList arrayList = null;
                foreach (object obj in this.Keys)
                {
                    WeakHashtable.EqualityWeakReference equalityWeakReference = obj as WeakHashtable.EqualityWeakReference;
                    if (equalityWeakReference != null && !equalityWeakReference.IsAlive)
                    {
                        if (arrayList == null)
                        {
                            arrayList = new ArrayList();
                        }
                        arrayList.Add(equalityWeakReference);
                    }
                }
                if (arrayList != null)
                {
                    foreach (object key in arrayList)
                    {
                        this.Remove(key);
                    }
                }
            }
            this._lastGlobalMem = totalMemory;
            this._lastHashCount = count;
        }
Exemple #4
0
 public IEnumerator <T> GetEnumerator()
 {
     foreach (object key in _hashTable.Keys)
     {
         WeakHashtable.EqualityWeakReference objRef = key as WeakHashtable.EqualityWeakReference;
         if (objRef != null)
         {
             T obj = objRef.Target as T;
             if (obj != null)
             {
                 yield return(obj);
             }
         }
     }
 }
 public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator()
 {
     foreach (object obj in _hashTable.Keys)
     {
         WeakHashtable.EqualityWeakReference keyRef = obj as WeakHashtable.EqualityWeakReference;
         if (keyRef != null)
         {
             TKey key = keyRef.Target as TKey;
             if (key != null)
             {
                 yield return(new KeyValuePair <TKey, TValue>(key, (TValue)_hashTable[obj]));
             }
         }
     }
 }
            public IEnumerator <KeyType> GetEnumerator()
            {
                WeakHashtable hashTable = Dict._hashTable;

                foreach (object obj in hashTable.Keys)
                {
                    WeakHashtable.EqualityWeakReference keyRef = obj as WeakHashtable.EqualityWeakReference;
                    if (keyRef != null)
                    {
                        KeyType key = keyRef.Target as KeyType;
                        if (key != null)
                        {
                            yield return(key);
                        }
                    }
                }
            }
        // Token: 0x06006571 RID: 25969 RVA: 0x001C7236 File Offset: 0x001C5436
        public IEnumerator <T> GetEnumerator()
        {
            foreach (object obj in this._hashTable.Keys)
            {
                WeakHashtable.EqualityWeakReference equalityWeakReference = obj as WeakHashtable.EqualityWeakReference;
                if (equalityWeakReference != null)
                {
                    T t = equalityWeakReference.Target as T;
                    if (t != null)
                    {
                        yield return(t);
                    }
                }
            }
            IEnumerator enumerator = null;

            yield break;
            yield break;
        }