Class EventUtility
This utility class is designed to make some event related operations easier to work with.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class EventUtility
Methods
| Improve this DocAddEvent<TEventArgs>(EventHandler<TEventArgs>, ref EventHandler<TEventArgs>)
A generic helper method for adding an event to a custom backing field backingFieldHandler
.
Declaration
public static void AddEvent<TEventArgs>(EventHandler<TEventArgs> handler, ref EventHandler<TEventArgs> backingFieldHandler)
where TEventArgs : EventArgs
Parameters
Type | Name | Description |
---|---|---|
System.EventHandler<TEventArgs> | handler | The method that will handle the event. |
System.EventHandler<TEventArgs> | backingFieldHandler | The backing field reference for the |
Type Parameters
Name | Description |
---|---|
TEventArgs | The type of the event data generated by the event. |
Remarks
The methodology is the same as in .NET 4.0.
Raise<TEventArgs>(EventHandler<TEventArgs>, Object, TEventArgs)
A generic helper method method for raising an event.
Declaration
public static void Raise<TEventArgs>(EventHandler<TEventArgs> handler, object sender, TEventArgs e)
where TEventArgs : EventArgs
Parameters
Type | Name | Description |
---|---|---|
System.EventHandler<TEventArgs> | handler | The method that will handle the event. |
System.Object | sender | The source of the event. |
TEventArgs | e | An System.EventArgs that contains the event data. |
Type Parameters
Name | Description |
---|---|
TEventArgs | The type of the event data generated by the event. |
RemoveEvent<TEventArgs>(EventHandler<TEventArgs>, ref EventHandler<TEventArgs>)
A generic helper method for removing an event from a custom backing field backingFieldHandler
.
Declaration
public static void RemoveEvent<TEventArgs>(EventHandler<TEventArgs> handler, ref EventHandler<TEventArgs> backingFieldHandler)
where TEventArgs : EventArgs
Parameters
Type | Name | Description |
---|---|---|
System.EventHandler<TEventArgs> | handler | The method that will handle the event. |
System.EventHandler<TEventArgs> | backingFieldHandler | The backing field reference for the |
Type Parameters
Name | Description |
---|---|
TEventArgs | The type of the event data generated by the event. |
Remarks
The methodology is the same as in .NET 4.0.