Mime PartGet Best Encoding(Encoding Constraint, Int 32, Cancellation Token) 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
The most efficient content encoding.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public ContentEncoding GetBestEncoding(
EncodingConstraint constraint,
int maxLineLength,
CancellationToken cancellationToken = default
)Parameters
- constraint EncodingConstraint
- The encoding constraint.
- maxLineLength Int32
- The maximum allowable length for a line (not counting the CRLF). Must be between 72 and 998 (inclusive).
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
ContentEncodingThe most efficient content encoding.
Implements
IMimePartGetBestEncoding(EncodingConstraint, Int32, CancellationToken)Remarks
Exceptions
| ArgumentOutOfRangeException |
maxLineLength is not between 72 and 998 (inclusive). -or- 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. |