src/Orleans.Serialization/Buffers/Reader.cs
/// <summary>
/// Fills <paramref name="destination"/> with bytes read from the input.
/// </summary>
/// <param name="destination">The destination.</param>
Fills  with bytes read from the input.
Fills with bytes read from the input .
public void ReadBytes(in Span<byte> destination)
        {
            if (IsReadOnlySequenceInput || IsSpanInput)
            {
                if (_bufferPos + destination.Length <= _bufferSize)
                {
                    _currentSpan.Slice(_bufferPos, destination.Length).CopyTo(destination);
                    _bufferPos += destination.Length;
                    return;
                }
                CopySlower(in destination, ref this);
                static void CopySlower(in Span<byte> d, ref Reader<TInput> reader)
                {
                    var dest = d;
                    while (true)
                    {
                        var writeSize = Math.Min(dest.Length, reader._currentSpan.Length - reader._bufferPos);
                        reader._currentSpan.Slice(reader._bufferPos, writeSize).CopyTo(dest);
                        reader._bufferPos += writeSize;
                        dest = dest.Slice(writeSize);
                        if (dest.Length == 0)
                        {
                            break;
                        }
                        reader.MoveNext();
                    }
                }
            }
            else if (_input is ReaderInput readerInput)
            {
                readerInput.ReadBytes(in destination);
            }
            else
            {
                ThrowNotSupportedInput();
            }
        }
public void ReadBytes ( in Span < byte > destination ) { if ( IsReadOnlySequenceInput || IsSpanInput ) { if ( _bufferPos + destination . Length <= _bufferSize ) { _currentSpan . Slice ( _bufferPos , destination . Length ) . CopyTo ( destination ) ; _bufferPos += destination . Length ; return ; } CopySlower ( in destination , ref this ) ; static void CopySlower ( in Span < byte > d , ref Reader < TInput > reader ) { var dest = d ; while ( true ) { var writeSize = Math . Min ( dest . Length , reader . _currentSpan . Length - reader . _bufferPos ) ; reader . _currentSpan . Slice ( reader . _bufferPos , writeSize ) . CopyTo ( dest ) ; reader . _bufferPos += writeSize ; dest = dest . Slice ( writeSize ) ; if ( dest . Length == 0 ) { break ; } reader . MoveNext ( ) ; } } } else if ( _input is ReaderInput readerInput ) { readerInput . ReadBytes ( in destination ) ; } else { ThrowNotSupportedInput ( ) ; } }
Fills  with bytes read from the input.
Fills with bytes read from the input .
Span<byte>
in
destination
None