Esempio n. 1
0
 /// <summary>
 /// Clears this instance by removing all stored items.<para/>
 /// If a Default Intance Dispose method was provided, it will be called for
 /// every remove item.
 /// </summary>
 public static void Clear()
 {
     if (DefaultInstanceDispose != null)
     {
         T item;
         while (m_bag.TryPop(out item))
         {
             DefaultInstanceDispose(item);
         }
     }
     m_bag.Clear();
 }
Esempio n. 2
0
        private bool disposedValue = false; // 要检测冗余调用

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    mPool.Clear();
                }

                disposedValue = true;
            }
        }
Esempio n. 3
0
 public void ResetPool(Func <T> newObjectGen)
 {
     objectGenerator = newObjectGen;
     objects.Clear();
 }
 public void Clear()
 {
     _stack.Clear();
 }