Redzen.IO.MemoryBlockStream.ZeroSpareCapacity C# (CSharp) Method

ZeroSpareCapacity() private method

Ensure that any existing capacity after _length is zeroed.
private ZeroSpareCapacity ( ) : void
return void
        private void ZeroSpareCapacity()
        {
            // Handle tail of the first block to zero/reset.
            int blockIdx = _length / _blockSize;
            int blockOffset = _length % _blockSize;
            byte[] blk = _blockList[blockIdx];
            Array.Clear(blk, blockOffset, _blockSize - blockOffset);

            // Zero any further blocks.
            for(blockIdx++; blockIdx < _blockList.Count; blockIdx++)
            {
                blk = _blockList[blockIdx];
                Array.Clear(blk, 0, _blockSize);
            }
        }