GetRemoveMethod Method
Collapse the table of content
Expand the table of content

EventInfo.GetRemoveMethod Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Returns the method that is used to remove an event-handler delegate from the event source.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public MethodInfo GetRemoveMethod()

Return Value

Type: System.Reflection.MethodInfo
The method that is used to remove an event-handler delegate from the event source, or null if the method is not public.

ExceptionCondition
MemberAccessException

This member is invoked late-bound through mechanisms such as Type.InvokeMember.

The method that is returned by GetRemoveMethod has a special name that consists of the prefix "remove_" followed by the name of the event, and is referred to as the remove accessor. The access level of the remove accessor is the same as the access level of the event. The remove accessor is called by compiled C# and Visual Basic code that unhooks event handlers, and by the RemoveEventHandler method, which is used to unhook event handlers in late-bound scenarios. It cannot be called directly from Visual Basic or C# source code. It can be called from dynamic code that is emitted by using the types in the System.Reflection.Emit namespace.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft