Mime EntityLoad Async(Content Type, Stream, Cancellation Token) Method
Asynchronously load a MimeEntity from the specified content stream.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The parsed MIME entity.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public static Task<MimeEntity> LoadAsync(
ContentType contentType,
Stream content,
CancellationToken cancellationToken = default
)Parameters
- contentType ContentType
- The Content-Type of the stream.
- content Stream
- The content stream.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskMimeEntityThe parsed MIME entity.
Remarks
This method is mostly meant for use with APIs such as HttpWebResponse
where the headers are parsed separately from the content.
Exceptions
| ArgumentNullException |
contentType is . -or- content is . |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| FormatException | There was an error parsing the entity. |
| IOException | An I/O error occurred. |