Beispiel #1
0
 public bool ContainsKey(TKey key)
 {
     this.RWLock.AcquireReaderLock(lockTimeout);
     try
     {
         return(InnerDict.Contains(key));
     }
     finally
     {
         this.RWLock.ReleaseReaderLock();
     }
 }
Beispiel #2
0
        protected override void OnRemove(int index, object value)
        {
            ExceptionHelper.TrueThrow <ArgumentNullException>(value == null, "value");

            this.RWLock.AcquireWriterLock(lockTimeout);
            try
            {
                TKey   key  = GetKeyFromItem((TValue)value);
                TValue data = (TValue)value;

                ExceptionHelper.FalseThrow <ArgumentException>(InnerDict.Contains(key),
                                                               Resource.InexistenceKey, typeof(TValue).Name, key);

                InnerDict.Remove(key);
                base.OnRemove(index, data);
            }
            finally
            {
                this.RWLock.ReleaseWriterLock();
            }
        }