EventHandlerExtensionsGetHandlerTDelegate Method
Gets the event handler of the specified type from the
EventHandlerList instance.
Namespace: KGySoft.WinFormsAssembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
public static TDelegate GetHandler<TDelegate>(
this EventHandlerList? handlers,
Object key
)
where TDelegate : Delegate
<ExtensionAttribute>
Public Shared Function GetHandler(Of TDelegate As Delegate) (
handlers As EventHandlerList,
key As Object
) As TDelegate
public:
[ExtensionAttribute]
generic<typename TDelegate>
where TDelegate : Delegate
static TDelegate GetHandler(
EventHandlerList^ handlers,
Object^ key
)
[<ExtensionAttribute>]
static member GetHandler :
handlers : EventHandlerList *
key : Object -> 'TDelegate when 'TDelegate : Delegate
- handlers EventHandlerList
- The EventHandlerList instance to het the handler delegate from.
- key Object
- The same key that is used for the AddHandler(Object, Delegate) and RemoveHandler(Object, Delegate) methods
when the event is subscribed or unsubscribed.
- TDelegate
- The delegate type of the event handler.
TDelegateThe event handler delegate of the specified type, or
if no such handler is found or the specified
TDelegate type does not match.In Visual Basic and C#, you can call this method as an instance method on any object of type
EventHandlerList. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).