LineWrappingTextWriterFlushAsync(Boolean, CancellationToken) Method

Clears all buffers for this TextWriter and causes any buffered data to be written to the underlying writer, optionally inserting an additional new line.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public Task FlushAsync(
	bool insertNewLine,
	CancellationToken cancellationToken = default
)

Parameters

insertNewLine  Boolean
Insert an additional new line if the line buffer is not empty. This has no effect if the line buffer is empty or the MaximumLineLength property is zero.
cancellationToken  CancellationToken  (Optional)
A token that can be used to cancel the operation.

Return Value

Task
A task that represents the asynchronous flush operation.

Remarks

If insertNewLine is set to , the LineWrappingTextWriter class will not know the length of the flushed line, and therefore the current line may not be correctly wrapped if more text is written to the LineWrappingTextWriter.

For this reason, it's recommended to only set insertNewLine to if you are done writing to this instance.

Indentation is reset by this method, so the next write after calling flush will not be indented.

The FlushAsync method is equivalent to calling this method with insertNewLine set to .

See Also