Mime ContentWrite To Async Method
Asynchronously copy the content stream to the specified output stream.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
An awaitable task.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Task WriteToAsync(
Stream stream,
CancellationToken cancellationToken = default
)Parameters
- stream Stream
- The output stream.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn awaitable task.
Implements
IMimeContentWriteToAsync(Stream, CancellationToken)Remarks
This is equivalent to simply using CopyTo(Stream) to copy the content stream to the output stream except that this method is cancellable.
Exceptions
| ArgumentNullException | stream is . |
| ObjectDisposedException | The MimeContent has been disposed. |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| IOException | An I/O error occurred. |