vb.net - Where should I dispose managed object held by a form? -


If I have a form that is the owner of Managed IDisposable objects that There is a need to stay around the farm (i.e. class level members, perhaps one class, wrapping and managing the timer for unit testing), when should I call disposable () ?

For the question (for example, "GC must settle it for you" to avoid the type of answer), assume that the additional calls need to be closed, for example:

  Buffer.Flush ()   

I present it in my partial class ( Form.Designer); Dispose () the current implementation of the method I can put in .vb ), but modifying that class usually velvet.

It looks like FormClosed or uninstalled event will be the best choice. Is there any reason to choose one for another reason?

Designer of "Proper" form. Method in the source code file of the form and edit it from the web file . Although it is weird in vb.net IDE, it will hide the file that you have to click on the Show All Files icon to view it.

It is wrong to use the farmclass, which will have to settle your objects very quickly when your form will appear with Shodial Log ().

It's okay to use a dispwied event.

Comments