Click or drag to resize
EventInfoAddEventHandler Method
Adds an event handler to an event source.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual void AddEventHandler(
	Object target,
	Delegate handler
)

Parameters

target
Type: SystemObject
The event source.
handler
Type: SystemDelegate
Encapsulates a method or methods to be invoked when the event is raised by the target.
Exceptions
ExceptionCondition
InvalidOperationExceptionThe event does not have a public add accessor.
ArgumentExceptionThe handler that was passed in cannot be used.
MethodAccessExceptionThe caller does not have access permission to the member.
TargetExceptionThe target parameter is null and the event is not static.-or- The EventInfo is not declared on the target.
See Also