WebClient.OnUploadStringCompleted(UploadStringCompletedEventArgs) 方法

定义

引发 UploadStringCompleted 事件。

protected:
 virtual void OnUploadStringCompleted(System::Net::UploadStringCompletedEventArgs ^ e);
protected virtual void OnUploadStringCompleted (System.Net.UploadStringCompletedEventArgs e);
abstract member OnUploadStringCompleted : System.Net.UploadStringCompletedEventArgs -> unit
override this.OnUploadStringCompleted : System.Net.UploadStringCompletedEventArgs -> unit
Protected Overridable Sub OnUploadStringCompleted (e As UploadStringCompletedEventArgs)

参数

示例

下面的代码示例演示此方法的实现,该方法可由派生自 WebClient的类进行自定义。

virtual void OnUploadStringCompleted( UploadStringCompletedEventArgs ^ e ) override
{
   // Here you can perform any custom actions before the event is raised
   // and event handlers are called...
   WebClient::OnUploadStringCompleted( e );

   // Here you can perform any post event actions...
}
protected override void OnUploadStringCompleted (UploadStringCompletedEventArgs e)
{
    // Here you can perform any custom actions before the event is raised
    // and event handlers are called...

    base.OnUploadStringCompleted (e);

    // Here you can perform any post event actions...
}

注解

从此类继承的类可以重写此方法,以在事件发生时 UploadStringCompleted 执行其他任务。

引发事件时,将通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件

OnUploadStringCompleted 方法还允许派生类对事件进行处理而不必附加委托。 这是在派生类中处理事件的首选技术。

继承者说明

在派生类中重写 OnUploadStringCompleted(UploadStringCompletedEventArgs) 时,请务必调用基类的 OnUploadStringCompleted(UploadStringCompletedEventArgs) 方法,以便注册的委托接收事件。

适用于