Beispiel #1
0
 private void Allocate(Int32 nAllocations)
 {
     for (var n = 0; n < nAllocations; n++)
     {
         Inactive.Push(new T()); // Lazy<T> would defer invocation of initBoard()
     }
 }
Beispiel #2
0
        public void Pop(ref T top)
        {
            if (top is null)
            {
                throw new ArgumentNullException("Pool.pop() called with null argument");
            }

            Inactive.Push(top);
            DecActive();
            top = DefaultElement;
        }