Example #1
0
        /// <summary>
        ///     Removes an instance at the specified index
        /// </summary>
        /// <param name="index"></param>
        public new void RemoveAt(int index)
        {
            var item = this[index];

            base.RemoveAt(index);
            GlobalPool.RemoveInstance(item);
        }
Example #2
0
 /// <summary>
 ///     Removes an instance from the dictionary
 /// </summary>
 /// <param name="key">The instance to remove</param>
 /// <returns>
 ///     <see langword="true" /> if the instance was in dictionary and removed, otherwise <see langword="false" />
 /// </returns>
 public new bool Remove(object key)
 {
     if (!base.Remove(key))
     {
         return(false);
     }
     GlobalPool.RemoveInstance(key);
     return(true);
 }
Example #3
0
        /// <summary>
        ///     Adds a new instance and its value to the dictionary
        /// </summary>
        /// <param name="key">The instance</param>
        /// <param name="value">The instance value</param>
        public new void Add(object key, T value)
        {
            var contains = ContainsKey(key);

            base.Add(key, value); // may raise an exception, or not?
            if (!contains)
            {
                GlobalPool.AddInstance(key);
            }
        }
Example #4
0
 /// <summary>
 ///     Adds a new instance to the list
 /// </summary>
 /// <param name="item">The instance to add</param>
 public new void Add(object item)
 {
     base.Add(item);
     GlobalPool.AddInstance(item);
 }