Click or drag to resize
WriteAsyncCallback Delegate
References a method to be called when bytes need to written to a sink asynchronously.

Namespace: Lawo.IO
Assembly: Lawo (in Lawo.dll) Version: 1.4.1707.27006
Syntax
C#
public delegate Task WriteAsyncCallback(
	byte[] buffer,
	int offset,
	int count,
	CancellationToken cancellationToken
)

Parameters

buffer
Type: SystemByte
offset
Type: SystemInt32
count
Type: SystemInt32
cancellationToken
Type: System.ThreadingCancellationToken

Return Value

Type: Task
Remarks
The referenced method must behave exactly like WriteAsync(Byte, Int32, Int32, CancellationToken). Notably, calling code that needs to cancel a write operation will do so as follows:
  1. It will call Cancel on the object from which cancellationToken originated and wait for an OperationCanceledException to be thrown.
  2. If no OperationCanceledException is thrown within say 500 milliseconds, Dispose is called on the object representing the sink and the caller then waits for either an OperationCanceledException or an ObjectDisposedException.
The steps above ensure that cancellation will work correctly for APIs that do support CancellationToken as well as for those that don't (where the recommended practice is to simply call Dispose on the object representing the sink.
See Also