public StackWindow Pop() { _count--; StackWindow result = _stackWindows[_count]; _stackWindows[_count] = null; return(result); }
public void Push(StackWindow stackWindow) { if (_count >= _maxCallDepth) { throw new BaseException(BaseException.Codes.CallStackOverflow, _maxCallDepth); } EnsureCapacity(_count); _stackWindows[_count] = stackWindow; _count++; }
private void EnsureCapacity(int requiredCapacity) { if (_stackWindows.Length <= requiredCapacity) { StackWindow[] newStackWindows = new StackWindow[Math.Max(_stackWindows.Length, 1) * 2]; for (int index = 0; index < _stackWindows.Length; index++) { newStackWindows[index] = _stackWindows[index]; } _stackWindows = newStackWindows; } }