EventHandler<TSender,TEventArgs> Delegate

Definition

Represents the method that will handle an event when the event provides data.

generic <typename TSender, typename TEventArgs>
public delegate void EventHandler(TSender sender, TEventArgs e);
public delegate void EventHandler<in TSender,in TEventArgs>(TSender sender, TEventArgs e) where TSender : allows ref struct where TEventArgs : allows ref struct;
type EventHandler<'Sender, 'EventArgs> = delegate of 'Sender * 'EventArgs -> unit
Public Delegate Sub EventHandler(Of In TSender, In TEventArgs)(sender As TSender, e As TEventArgs)

Type Parameters

TSender

The type of the object raising the event.

This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
TEventArgs

The type of the event data generated by the event.

This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.

Parameters

sender
TSender

The source of the event.

e
TEventArgs

An object that contains the event data.

Extension Methods

GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to