1

In Powershell, one may hook an event on a .NET object by calling add_EventName, like this:

$MyBlock = [System.EventHandler]{Write-Host Hello}
$MyObject.add_Completed($MyBlock)

How does one remove that event handler? Or reset the event to the state with no handlers?

This arised from here.

1 Answer 1

2

Like this:

$MyObject.remove_Completed($MyBlock)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.