EventHandlerExtensionsSafeInvokeAsyncTEventHandler, TEventArgs(TEventHandler, Object, TEventArgs, Boolean) Method

Safely invokes event propagation asynchronously, continuing even if an attached user handler throws an exception.

Definition

Namespace: Gemstone.EventHandlerExtensions
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static Task SafeInvokeAsync<TEventHandler, TEventArgs>(
	this TEventHandler eventHandler,
	Object? sender,
	TEventArgs args,
	bool parallel = false
)
where TEventHandler : MulticastDelegate
where TEventArgs : EventArgs

Parameters

eventHandler  TEventHandler
Source EventHandler to safely invoke.
sender  Object
Event source.
args  TEventArgs
Event arguments.
parallel  Boolean  (Optional)
Call event handlers in parallel, when attached handlers are greater than one.

Type Parameters

TEventHandler
MulticastDelegate type commonly derived from EventHandler.
TEventArgs
Type derived from EventArgs.

Return Value

Task

[Missing <returns> documentation for "M:Gemstone.EventHandlerExtensions.EventHandlerExtensions.SafeInvokeAsync``2(``0,System.Object,``1,System.Boolean)"]

Usage Note

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).

Remarks

Event handler invocation list access will be locked on eventHandler. Any exceptions will be suppressed, see SuppressedException and other overloads for custom exception handling.

See Also