Unsubscribing from an event
C#
2
Posts
2
Posters
0
Views
1
Watching
-
I have an instance of class A that publishes an event and several instances of class B that subscribe to it. How can I get a B instance to UNsubscribe from the event?
It's just like subscribing to the event, except that you use -= instead of +=
intanceOfA.FireTorpedoes -= new EventHandler(intanceOfA_FireTorpedoes);
Charlie if(!curlies){ return; }