System.Net.Mail.SmtpClient.ContextSafeCompleteCallback C# (CSharp) Method

ContextSafeCompleteCallback() private static method

private static ContextSafeCompleteCallback ( IAsyncResult ar ) : void
ar IAsyncResult
return void
        private static void ContextSafeCompleteCallback(IAsyncResult ar)
        {
            ContextAwareResult result = (ContextAwareResult)ar;
            SmtpClient client = (SmtpClient)ar.AsyncState;
            Exception exception = result.Result as Exception;
            AsyncOperation asyncOp = client._asyncOp;
            AsyncCompletedEventArgs eventArgs = new AsyncCompletedEventArgs(exception, client._cancelled, asyncOp.UserSuppliedState);
            client.InCall = false;
            client._failedRecipientException = null; // Reset before the next send.
            asyncOp.PostOperationCompleted(client._onSendCompletedDelegate, eventArgs);
        }