Class PipeWriterExtensions
- Namespace
- ShapeShift
- Assembly
- ShapeShift.dll
Extension methods for PipeWriter.
public static class PipeWriterExtensions
- Inheritance
-
PipeWriterExtensions
- Inherited Members
Methods
FlushAndThrowIfCanceledAsync(PipeWriter, CancellationToken)
Flushes a PipeWriter, translating a canceled flush into an OperationCanceledException.
public static ValueTask FlushAndThrowIfCanceledAsync(this PipeWriter writer, CancellationToken cancellationToken)
Parameters
writerPipeWriterThe writer to flush.
cancellationTokenCancellationTokenThe cancellation token to throw from, when the flush reports IsCanceled.
Returns
- ValueTask
A task that represents the asynchronous flush operation.
Remarks
FlushAsync(CancellationToken) reports cancellation through the returned FlushResult rather than by throwing, which is easy to overlook. This method restores the more familiar throwing behavior expected of asynchronous APIs elsewhere in .NET.