- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between dispose() and finalize() in C#
In this post, we will understand the difference between the methods ‘dispose’, and ‘finalize’ in C#.
This method is defined in the IDisposable interface.
It has to be invoked by the user.
Whenever it is invoked, it helps free the unmanaged resources.
It can be implemented whenever a close() method is present.
It is declared as public method.
It is quick, and instantly disposes an object.
Since it performs instantaneously, it doesn’t affect performance.
It is a method that is defined in the java.lang.object class.
It is invoked by the garbage collector.
It helps free the unmanaged resources just before the object is destroyed.
It is implemented to manage the unmanaged resources.
It is declared as private.
It is slower in comparison to the ‘dispose’ method.
Since it is slow, it affects the performance of the websites or applications.
Kickstart Your Career
Get certified by completing the courseGet Started