Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unsubscribe all event handler of all events
Message
From
03/05/2009 02:48:57
 
 
To
02/05/2009 22:35:31
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01397637
Message ID:
01397644
Views:
40
Why do you want to do this?

Update : I can guess. You could try using the System.WeakReference class instead. Here's an example:
http://blog.codeinreview.com/post/2008/11/27/NET-EVENTS-(Part-3-A-Weak-Solution).aspx
HTH,
Viv


>Hi,
>How could I unsubscribe all event handlers of all events of my object?
>For example, I have a classA, which contains events OnSomethingHappen and OnSomethingNotHappen. During Dispose, I would like to unsubscribe all event handler that attached to these events.
>
>Remark: the code should be dynamic as I would like to auto unsubscribe for all without need to hardcode them differently for each class.
>
>Please advice.
>
>Thank you
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform