Finalize method is incredibly useful because it ensures that unmanaged resources aren’t leaked when managed objects have their memory reclaimed. However, the problem with the
Finalize method is that you have no guarantee when it will be called, and because it isn’t a public method, a user of the class can’t call it explicitly.
The capability to deterministically dispose of or close an object is frequently useful when you’re working with unmanaged resources such as mutexes and bitmaps; this capability is even more useful when you’re working with files and database connections. For example, you might want to open a database connection, query some records, and close the database connection—you ...