SmtpClient.OnSendCompleted(AsyncCompletedEventArgs) 方法

定义

引发 SendCompleted 事件。Raises the SendCompleted event.

protected:
 void OnSendCompleted(System::ComponentModel::AsyncCompletedEventArgs ^ e);
protected void OnSendCompleted (System.ComponentModel.AsyncCompletedEventArgs e);
member this.OnSendCompleted : System.ComponentModel.AsyncCompletedEventArgs -> unit
Protected Sub OnSendCompleted (e As AsyncCompletedEventArgs)

参数

e
AsyncCompletedEventArgs

包含事件数据的 AsyncCompletedEventArgsAn AsyncCompletedEventArgs that contains event data.

注解

SmtpClient 类继承的类可以重写 OnSendCompleted 方法,以便在 SendCompleted 事件发生时执行其他任务。Classes that inherit from the SmtpClient class can override the OnSendCompleted method to perform additional tasks when the SendCompleted event occurs.

OnSendCompleted 还允许派生类处理 SendCompleted,而无需附加委托。OnSendCompleted also allows derived classes to handle SendCompleted without attaching a delegate. 这是在派生类中处理 SendCompleted 的首选方法。This is the preferred technique for handling SendCompleted in a derived class.

继承者说明

当在派生类中重写 OnSendCompleted(AsyncCompletedEventArgs) 时,请确保调用基类的 "OnSendCompleted(AsyncCompletedEventArgs) 方法,以便注册的委托接收 SendCompleted 事件。When overriding OnSendCompleted(AsyncCompletedEventArgs) in a derived class, be sure to call the base class' OnSendCompleted(AsyncCompletedEventArgs) method so that registered delegates receive the SendCompleted event.

适用于