Bewerken

Delen via


Ping.OnPingCompleted(PingCompletedEventArgs) Method

Definition

Raises the PingCompleted event.

protected:
 void OnPingCompleted(System::Net::NetworkInformation::PingCompletedEventArgs ^ e);
protected void OnPingCompleted (System.Net.NetworkInformation.PingCompletedEventArgs e);
member this.OnPingCompleted : System.Net.NetworkInformation.PingCompletedEventArgs -> unit
Protected Sub OnPingCompleted (e As PingCompletedEventArgs)

Parameters

e
PingCompletedEventArgs

A PingCompletedEventArgs object that contains event data.

Remarks

Classes that inherit from the Ping class can override this method to perform additional tasks, such as logging the data contained in the e parameter.

Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.

The OnPingCompleted 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.

Notes to Inheritors

When overriding OnPingCompleted(PingCompletedEventArgs) in a derived class, be sure to call the base class' OnPingCompleted(PingCompletedEventArgs) method so that registered delegates receive the event.

Applies to