PipeReader.AdvanceTo Method

Definition

Moves forward the pipeline's read cursor to after the consumed data.

Overloads

AdvanceTo(SequencePosition)

Moves forward the pipeline's read cursor to after the consumed data, marking the data as processed.

AdvanceTo(SequencePosition, SequencePosition)

Moves forward the pipeline's read cursor to after the consumed data, marking the data as processed, read and examined.

Remarks

The memory for the consumed data will be released and no longer available. The Buffer previously returned from ReadAsync(CancellationToken) must not be accessed after this call. The examined data communicates to the pipeline when it should signal more data is available.

AdvanceTo(SequencePosition)

Source:
PipeReader.cs
Source:
PipeReader.cs
Source:
PipeReader.cs

Moves forward the pipeline's read cursor to after the consumed data, marking the data as processed.

public:
 abstract void AdvanceTo(SequencePosition consumed);
public abstract void AdvanceTo (SequencePosition consumed);
abstract member AdvanceTo : SequencePosition -> unit
Public MustOverride Sub AdvanceTo (consumed As SequencePosition)

Parameters

consumed
SequencePosition

Marks the extent of the data that has been successfully processed.

Remarks

The memory for the consumed data will be released and no longer available.

The Buffer previously returned from ReadAsync(CancellationToken) must not be accessed after this call.

This is equivalent to calling AdvanceTo(SequencePosition, SequencePosition) with identical examined and consumed positions. The examined data communicates to the pipeline when it should signal more data is available.

Because the consumed parameter doubles as the examined parameter, the consumed parameter should be greater than or equal to the examined position in the previous call to AdvanceTo. Otherwise, an InvalidOperationException is thrown.

Applies to

AdvanceTo(SequencePosition, SequencePosition)

Source:
PipeReader.cs
Source:
PipeReader.cs
Source:
PipeReader.cs

Moves forward the pipeline's read cursor to after the consumed data, marking the data as processed, read and examined.

public:
 abstract void AdvanceTo(SequencePosition consumed, SequencePosition examined);
public abstract void AdvanceTo (SequencePosition consumed, SequencePosition examined);
abstract member AdvanceTo : SequencePosition * SequencePosition -> unit
Public MustOverride Sub AdvanceTo (consumed As SequencePosition, examined As SequencePosition)

Parameters

consumed
SequencePosition

Marks the extent of the data that has been successfully processed.

examined
SequencePosition

Marks the extent of the data that has been read and examined.

Remarks

The memory for the consumed data will be released and no longer available.

The Buffer previously returned from ReadAsync(CancellationToken) must not be accessed after this call.

The examined data communicates to the pipeline when it should signal more data is available.

The examined parameter should be greater than or equal to the examined position in the previous call to AdvanceTo. Otherwise, an InvalidOperationException is thrown.

Applies to