public bool Remove(KeyValuePair <string, object> item)
        {
            var isRemoved = InnerDictionary.Remove(item);

            if (isRemoved && item.Value is IDisposable)
            {
                Disposables.RemoveAll(_ => item.Value.Equals(_));
            }
            return(isRemoved);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public bool Remove(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            EnsureWritable();
            return(InnerDictionary.Remove(key));
        }
 public bool Remove(string key)
 {
     if (InnerDictionary.ContainsKey(key))
     {
         MethodParameterValue value = InnerDictionary[key];
         if (value != null)
         {
             value.SetOwner(null);
         }
     }
     return(InnerDictionary.Remove(key));
 }
        public bool Remove(string key)
        {
            if (!TryGetValue(key, out object correspondingValue))
            {
                return(false);
            }

            var isRemoved = InnerDictionary.Remove(key);

            if (isRemoved && correspondingValue is IDisposable)
            {
                Disposables.RemoveAll(_ => correspondingValue.Equals(_));
            }

            return(isRemoved);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the LazyDictionary.
 /// </summary>
 /// <param name="item">The object to remove from the LazyDictionary.</param>
 /// <returns>true if item was successfully removed from the LazyDictionary;
 /// otherwise, false. This method also returns false if item is not found in the original LazyDictionary.</returns>
 public bool Remove(KeyValuePair <TKey, TValue> item)
 {
     return(InnerDictionary.Remove(item));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Removes the value with the specified key from the LazyDictionary.
 /// </summary>
 /// <param name="key">The key of the element to remove.</param>
 /// <returns>True if the element is successfully found and removed; otherwise, false. This method returns false if key is
 /// not found in the LazyDictionary.</returns>
 public bool Remove(TKey key)
 {
     return(InnerDictionary.Remove(key));
 }
Ejemplo n.º 7
0
 /// <inheritdoc />
 public bool Remove(TKey key)
 {
     using (writeLock.LockWrite())
         return(InnerDictionary.Remove(key));
 }
Ejemplo n.º 8
0
 /// <inheritdoc />
 public bool Remove(KeyValuePair <TKey, TValue> item)
 {
     using (writeLock.LockWrite())
         return(InnerDictionary.Remove(item));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 删除Cache项
 /// </summary>
 /// <param name="key">Cache项键值</param>
 /// <param name="item">Cache项</param>
 private void InnerRemove(TKey key, CacheItem <TKey, TValue> item)
 {
     InnerDictionary.Remove(key);
     item.Dispose();
 }