Click or drag to resize
MimeKit

MimeEntityLoad Method (ParserOptions, Stream, Boolean, CancellationToken)

Load a MimeEntity from the specified stream.

Namespace:  MimeKit
Assembly:  MimeKit (in MimeKit.dll) Version: 3.0.0
Syntax
C#
public static MimeEntity Load(
	ParserOptions options,
	Stream stream,
	bool persistent,
	CancellationToken cancellationToken = default
)

Parameters

options
Type: MimeKitParserOptions
The parser options.
stream
Type: System.IOStream
The stream.
persistent
Type: SystemBoolean
true if the stream is persistent; otherwise false.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Return Value

Type: MimeEntity
The parsed MIME entity.
Exceptions
ExceptionCondition
ArgumentNullException

options is null.

-or-

stream is null.

OperationCanceledException The operation was canceled via the cancellation token.
FormatException There was an error parsing the entity.
IOException An I/O error occurred.
Remarks

Loads a MimeEntity from the given stream, using the specified ParserOptions.

If persistent is true and stream is seekable, then the MimeParser will not copy the content of MimeParts into memory. Instead, it will use a BoundStream to reference a substream of stream. This has the potential to not only save mmeory usage, but also improve MimeParser performance.

See Also