----------------------------------------------------------- New Message on MumbaiUserGroup
----------------------------------------------------------- From: Rohit_BD Message 2 in Discussion Finalize is usually never used or defined explicitly. I am not very sure of the reasons for this. However, creating a "Finalizer" for a user-defined class is the same as defining the class's detructor. In other words, the class's Destructor is the Finalizer of that class. Finalizers (rather Destructors) are recommended so that expensive resources are released when the GC decides to remove the object from memory. Destructors by themselves have no guarantee of being called when an object goes out of scope, but when it is called, it ensures that resources are released explicitly. The GC and run-time may not release resources used by an object when it garbage collects that object. This is especially true for user defined classes, that internally use other user-defined class (or resource intensive) object instances. That said, relying solely on destructors is not recommened simply because there is no guarantee when they will be called. By the time the destructor is called, the object may well have used up resources. Given a large number of similar objects, this may well lead to too much resource usage. To ensure that resources are released, first implement a Dispose() method for the object and release resources within this method. Call this method everytime the object is no longer to be used. After this, implement the destructor also, to take care of situations where you may have forgotten to call Dispose(). ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
