EventInfo::RemoveEventHandler Method (Object^, Delegate^)
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 disassociated from the events raised by target.
| 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. | ||
| MethodAccessException |
The caller does not have access permission to the member. |
This method attempts to remove the delegate that may synchronize this event on the target object.
When an event is raised by target, the method or methods encapsulated by handler will no longer be invoked.
when invoked late-bound through mechanisms such as Type::InvokeMember. Associated enumeration: ReflectionPermissionFlag::MemberAccess.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
