MailKit.Net.Imap.ImapClient.CompressAsync C# (CSharp) Method

CompressAsync() public method

Asynchronously enable compression over the IMAP connection.

Asynchronously enables compression over the IMAP connection.

If the IMAP server supports the ImapCapabilities.Compress extension, it is possible at any point after connecting to enable compression to reduce network bandwidth usage. Ideally, this method should be called before authenticating.

/// The has been disposed. /// /// The is not connected. /// /// Compression must be enabled before a folder has been selected. /// /// The IMAP server does not support the COMPRESS extension. /// /// The operation was canceled via the cancellation token. /// /// An I/O error occurred. /// /// The server replied to the COMPRESS command with a NO or BAD response. /// /// An IMAP protocol error occurred. ///
public CompressAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : System.Threading.Task
cancellationToken System.Threading.CancellationToken The cancellation token.
return System.Threading.Task
		public Task CompressAsync (CancellationToken cancellationToken = default (CancellationToken))
		{
			return Task.Factory.StartNew (() => {
				lock (SyncRoot) {
					Compress (cancellationToken);
				}
			}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
		}