private void ResizeBuffer(int newSize)
{
// Even though Array.Resize allocates, copies then assigns we require this behaviour
// to support snapshots and therefore cannot rely on a private implementation detail.
var newArray = new byte[newSize];
Buffer.BlockCopy(_buffer, 0, newArray, 0, _count);
_buffer = newArray;
}