/// <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); }
/// <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); }
/// <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); } }
/// <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); }