示例#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();
 }
示例#2
0
文件: Pool.cs 项目: wanglong/BeetleX
        private bool disposedValue = false; // 要检测冗余调用

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

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