private void Allocate(Int32 nAllocations) { for (var n = 0; n < nAllocations; n++) { Inactive.Push(new T()); // Lazy<T> would defer invocation of initBoard() } }
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; }