EventInfo.RemoveEventHandler Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Removes an event handler from an event source.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- target
- Type: System.Object
The event source.
- handler
- Type: System.Delegate
The delegate to be unhooked from the event source.
| Exception | Condition |
|---|---|
| InvalidOperationException | The event does not have a public remove accessor. |
| ArgumentException | The handler that was passed in cannot be used. |
| TargetException | The target parameter is null and the event is not static. -or- The EventInfo is not declared on the target. |
| MemberAccessException | This member is invoked late-bound through mechanisms such as Type.InvokeMember. |
Use the AddEventHandler method to hook up events in late-bound scenarios.
This method attempts to unhook an event handler for the current event on the event source specified by target, by calling the remove accessor.
Note: |
|---|
In reflection, the remove accessor can be obtained by calling the GetRemoveMethod method. |
For an example, see the AddEventHandler method.
Note: