Friday 6 July 2012

What is the difference between Finalize() and Dispose()?

Purpose:
  • Even though .Net is a managed framework it does not abscond developers from having to understand how memory management works under the hood. Being able to explain the purpose behind the IDisposable interface and supporting language features to manipulate garbage collection is a mark of a professional developer.
  • Also there is well known best practice way of implementing IDisposable that requires the use of the Finalizer. Knowledge of these language constructs suggests that the developer has a good grasp of things.

Potential Answer:
The Finalize is non public and is called by the Garbage collector whereas the Dispose method can be invoked by the user which will cause the Garbage collector to invoke the finalize method.

No comments:

Post a Comment