• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in C Sharp by
What is the difference between dispose() and finalize() methods in C#?

1 Answer

0 votes
The dispose() method is explicitly called by user to free unmanaged resources such as files, database connections etc whereas finalize() method is implicitly called by garbage collector to free unmanaged resources like files, database connections etc.

The dispose() method belongs to IDisposable interface whereas finalize() method belongs the Object class.

Related questions

0 votes
asked May 5, 2021 in JAVA by SakshiSharma
0 votes
asked May 6, 2020 in C Sharp by SakshiSharma