WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs) メソッド

定義

DownloadStringCompleted イベントを発生させます。Raises the DownloadStringCompleted event.

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

パラメーター

e
DownloadStringCompletedEventArgs

イベント データを格納している DownloadStringCompletedEventArgs オブジェクト。A DownloadStringCompletedEventArgs object containing event data.

次のコード例は、から派生したクラスによってカスタマイズできる、このメソッドの実装を示して WebClient います。The following code example shows an implementation of this method that can be customized by a class derived from WebClient.

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

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

    base.OnDownloadStringCompleted (e);

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

注釈

このクラスを継承するクラスは、このメソッドをオーバーライドして、イベントが発生したときに追加のタスクを実行でき DownloadStringCompleted ます。Classes that inherit from this class can override this method to perform additional tasks when the DownloadStringCompleted event occurs.

イベントを発生させると、イベント ハンドラーがデリゲートから呼び出されます。Raising an event invokes the event handler through a delegate. 詳細については、処理とイベントの発生 を参照してください。For more information, see Handling and Raising Events.

OnDownloadStringCompleted メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。The OnDownloadStringCompleted method also allows derived classes to handle the event without attaching a delegate. 派生クラスでイベントを処理する場合は、この手法をお勧めします。This is the preferred technique for handling the event in a derived class.

注意 (継承者)

派生クラスでをオーバーライドする場合は OnDownloadStringCompleted(DownloadStringCompletedEventArgs) 、登録されて OnDownloadStringCompleted(DownloadStringCompletedEventArgs) いるデリゲートがイベントを受け取るように、基本クラスのメソッドを呼び出す必要があります。When overriding OnDownloadStringCompleted(DownloadStringCompletedEventArgs) in a derived class, be sure to call the base class' OnDownloadStringCompleted(DownloadStringCompletedEventArgs) method so that registered delegates receive the event.

適用対象