Does assigning null remove all event handlers from an object?

后端 未结 4 567
终归单人心
终归单人心 2020-12-29 02:33

I have defined new member in my class

protected COMObject.Call call_ = null;

This class has the following event handler that I subscribed t

4条回答
  •  生来不讨喜
    2020-12-29 03:08

    yes, you should use overloaded -= to unsubscribe an event.

    simply assigning a reference to null will not do that automatically. The object will still be listening to that event.

提交回复
热议问题