Пример #1
0
        /// <summary>Removes a specific <see cref="ExcelPoolItem"/> object.
        /// </summary>
        /// <param name="name">The name of the <see cref="ExcelPoolItem"/> object to remove.</param>
        /// <returns><c>true</c> if the element is sucessfully found and removed; otherwise, <c>false</c>.</returns>
        /// <remarks>If the value of the <see cref="ExcelPoolItem"/> object to remove implements the <see cref="IDisposable"/> interface, a
        /// freeing, releasing, or resetting of unmanaged resources will be applied.</remarks>
        public static bool RemoveItem(string name)
        {
            ExcelPoolItem itemToRemove;

            if (sm_Pool.TryGetValue(name, out itemToRemove) == true)
            {
                if (itemToRemove.Value is IDisposable)
                {
                    ((IDisposable)itemToRemove.Value).Dispose();
                }
                return(sm_Pool.Remove(name));
            }
            return(false);
        }