I read on MSDN , which requires Unsubscribing from all events that an object must have in order to manage it from memory. I always used - = to delete all event references inside my object (for example, show MSDN).
Now I have to support the code, and there is a memory leak on it. I see that the previous developer simply installed an object that has all the events, subscribes to it in NULL and does not - = each event method.
Example:
_watcher.Changed += new ...
_watcher.Created += new ...
_watcher.Deleted += ..
_watcher = NULL;
Is this a good way or saves a variable in memory?
source
share