EventHandlerExtensionsSafeInvokeTEventHandler, TEventArgs(TEventHandler, Object, ActionException, Object, TEventArgs, Boolean) Method
Safely invokes event propagation with custom exception handler, continuing even if an attached user handler throws an exception.
Namespace: Gemstone.EventHandlerExtensionsAssembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static void SafeInvoke<TEventHandler, TEventArgs>(
this TEventHandler eventHandler,
Object? eventLock,
Action<Exception>? exceptionHandler,
Object? sender,
TEventArgs args,
bool parallel = false
)
where TEventHandler : MulticastDelegate
where TEventArgs : EventArgs
<ExtensionAttribute>
Public Shared Sub SafeInvoke(Of TEventHandler As MulticastDelegate, TEventArgs As EventArgs) (
eventHandler As TEventHandler,
eventLock As Object,
exceptionHandler As Action(Of Exception),
sender As Object,
args As TEventArgs,
Optional parallel As Boolean = false
)
public:
[ExtensionAttribute]
generic<typename TEventHandler, typename TEventArgs>
where TEventHandler : MulticastDelegate
where TEventArgs : EventArgs
static void SafeInvoke(
TEventHandler eventHandler,
Object^ eventLock,
Action<Exception^>^ exceptionHandler,
Object^ sender,
TEventArgs args,
bool parallel = false
)
JavaScript does not support generic types or methods.
- eventHandler TEventHandler
- Source EventHandler to safely invoke.
- eventLock Object
- Locking object for accessing event handler invocation list; when set to null, lock will be on eventHandler.
- exceptionHandler ActionException
- Custom delegate to handle encountered exceptions; when set to null, exception will be suppressed, see SuppressedException.
- sender Object
- Event source.
- args TEventArgs
- Event arguments.
- parallel Boolean (Optional)
- Call event handlers in parallel, when attached handlers are greater than one.
- TEventHandler
- MulticastDelegate type commonly derived from EventHandler.
- TEventArgs
- Type derived from EventArgs.
In Visual Basic and C#, you can call this method as an instance method on any object of type
TEventHandler. 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).