Share via


TracedEvent.AttachIfNotFired(Action, Boolean) Method

Definition

Attach the event handler only if the event has not fired before. You may specify invokeIfFired = true if you want to invoke the handler right away if the event has fired before.

public bool AttachIfNotFired (Action handler, bool invokeIfFired = false);
member this.AttachIfNotFired : Action * bool -> bool
Public Function AttachIfNotFired (handler As Action, Optional invokeIfFired As Boolean = false) As Boolean

Parameters

handler
Action

The event handler to attach, not null.

invokeIfFired
Boolean

A value indicating whether to invoke the handler if the event has fired before.

Returns

True if the handler is attached; Otherwise, false.

Applies to