Difference between “dispose” and “finalize” in C#
Dispose - This method uses interface – “IDisposable” interface and it will free up both managed and unmanaged codes like – database connection, files etc.
Finalize - This method is called internally unlike Dispose method which is called explicitly. It is called by garbage collector and can’t be called from the code.
Finalize – This method is used for garbage collection. So before destroying an object this method is called as part of clean up activity.
Finalize - This method is called internally unlike Dispose method which is called explicitly. It is called by garbage collector and can’t be called from the code.
Finalize – This method is used for garbage collection. So before destroying an object this method is called as part of clean up activity.

0 Comments