Mono Class Library: System.Reflection.EventInfo Overview | Members

System.Reflection.EventInfo.AddEventHandler Method

Adds the specified event handler delegate to the specified event source.

[System.Diagnostics.DebuggerStepThrough]
public void AddEventHandler (object target, Delegate handler)

Parameters

target
An object that represents an event source.
handler
A Delegate instance to be added to target that references methods to be invoked when the event reflected by the current instance is raised by target.

Exceptions

TypeReason
ArgumentExceptionhandler is not the same Type as the event handler delegate declared for the event reflected by the current instance.
System.Reflection.TargetExceptionThe event reflected by the current instance is non-static, and obj is null or is of a type that does not implement the event reflected by the current instance.

Remarks

Each time the event reflected by the current instance is raised by target, the methods in the invocation list of handler are invoked.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0