src/Orleans.Serialization/Buffers/Writer.cs
/// <summary>
/// Ensures that there are at least <paramref name="length"/> contiguous bytes available to be written.
/// </summary>
/// <param name="length">The number of contiguous bytes to ensure.</param>
Ensures that there are at least  contiguous bytes available to be written.
Ensures that there are at least contiguous bytes available to be written .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void EnsureContiguous(int length)
        {
            if (_bufferPos + length < _currentSpan.Length)
            {
                return;
            }
            Allocate(length);
#if DEBUG
            if (_currentSpan.Length < length)
            {
                ThrowTooLarge(length);
            }
            [MethodImpl(MethodImplOptions.NoInlining)]
            static void ThrowTooLarge(int l) => throw new InvalidOperationException($"Requested buffer length {l} cannot be satisfied by the writer.");
#endif
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] public void EnsureContiguous ( int length ) { if ( _bufferPos + length < _currentSpan . Length ) { return ; } Allocate ( length ) ; if DEBUG if ( _currentSpan . Length < length ) { ThrowTooLarge ( length ) ; } [ MethodImpl ( MethodImplOptions . NoInlining ) ] static void ThrowTooLarge ( int l ) => throw new InvalidOperationException ( $" Requested buffer length  { l }  cannot be satisfied by the writer. " ) ; endif }
Ensures that there are at least  contiguous bytes available to be written.
Ensures that there are at least contiguous bytes available to be written .
// The current buffer is adequate. // The current buffer is inadequate, allocate another. // Throw if the allocation does not satisfy the request.
length
int
The number of contiguous bytes to ensure.
The number of contiguous bytes to ensure .