private void EnsureCapacity(int count) { checked { int requiredCapacity = _count + count; if(requiredCapacity > _buffer.Length) { int newSize = _buffer.Length * 2; while(newSize < requiredCapacity) { newSize *= 2; } ResizeBuffer(newSize); } } }