简体   繁体   中英

How to deregister delegate handler during runtime

I am registering delegate handler using unity during the initialization of webapi,during runtime i need to deregister the same handler,how can i achieve this? I am developing the application in c#

It would be helpful if you can update the question with some code which you have written to add the handler. Anyway to remove a handler you can simply use -= operator.

To Remove handler

backgroundWorker.DoWork -= mehtodName;

To Add handler I think you might be using something similar to below code to add the handler.?

backgroundWorker.DoWork += mehtodName;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM