This is more an overall design best-practices for AutoCAD/C#.NET than a specific coding problem. I'm still at the (re)design stage of my application.
Suppose you're registering different events at the Application, Document Collection, and Document levels. Let's further suppose the Application and Document Collection event handlers get constructed/registered when the application is started. Obviously I want those objects to persist as long as the application is open (or until I'm done with them, at least).
The Document event handler could be constructed/registered by the Document Collection event handler at the DocumentCreated event and disposed of at DocumentDestroyed... but should it? One could also have the Document-level event handler constructed by the Document Collection event handler at the DocumentBecameCurrent event, and then unregistered and disposed of at DocumentToBeDeactivated.
As far as I can tell, the decision whether to do this is dependent on whether the resources for construction/destruction of the Document event handler outweigh the resources required to maintain the Document event handler when the document isn't active, right? But if I'm responding only to CommandWillStart or BeginDocumentClose events, then there won't be any events that I need to respond to while the document is inactive, right? Or in other words, what Document events can be triggered while the inactive?
What I'm worried about is the all-too-common-at-my-firm situation where the user has 12 drawings open, and now I've got 12 Document event handler objects floating around. If the documents they are watching aren't active, are they using up much in the way of resources?