MimePartGetBestEncoding(EncodingConstraint, CancellationToken) Method

Calculate the most efficient content encoding given the specified constraint.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public ContentEncoding GetBestEncoding(
	EncodingConstraint constraint,
	CancellationToken cancellationToken = default
)

Parameters

constraint  EncodingConstraint
The encoding constraint.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

ContentEncoding
The most efficient content encoding.

Implements

IMimePartGetBestEncoding(EncodingConstraint, CancellationToken)

Remarks

If no Content is set, SevenBit will be returned.

Exceptions

ArgumentOutOfRangeException constraint is not a valid value.
ObjectDisposedException The MimePart has been disposed.
OperationCanceledException The operation was canceled via the cancellation token.
IOException An I/O error occurred.

See Also