The main difference between Dispose and Finalize is that:
Dispose
is usually called by your code. The resources are freed instantly when you call it. People forget to call the method, so using() {}
statement is invented. When your program finishes the execution of the code inside the {}
, it will call Dispose
method automatically.
Finalize
is not called by your code. It is mean to be called by the Garbage Collector (GC). That means the resource might be freed anytime in future whenever GC decides to do so. When GC does its work, it will go through many Finalize methods. If you have heavy logic in this, it will make the process slow. It may cause performance issues for your program. So be careful about what you put in there.
I personally would write most of the destruction logic in Dispose. Hopefully, this clears up the confusion.