I don't see anything wrong with the way you use the classes. The GC will remove the objects from memory (including the form) when the variable that hold the reference to the form goes out of scope or is set to null (not when Close is called).
>I have a windows project that is comprised of multiple windows forms. In this project I have 3 support classes
>BrObjects (Business objects)
>BrValidation (various validation routines and value checking calls)
>DataManager (handles querys, getting datasets, executing data commands etc)
>
>Each windows form in the project needs and utilizes these 3 classes.
>
>So here is my theory question: I currently create an instance of each of the 3 classes in each form (works fine). Is that the best way to do it? Is there a better way? Is it true that when the form is close() that Garbage Collection will eventually remove the memory used by the instance of these 3 classes?
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement