Friday, March 13, 2015

Difference between Finalize & Dispose Method in Asp.net

Here i am going to describe the difference between Finalize & Dispose Method in Asp.net
Finalize

  • Finalize method internally called by Garbage collector which is the features of .Net Framework it cannot called by user.
  • if is there any free unmanaged resources such as files, variables, database objects & connections that will destroyed.
  • It is associated with Object Class.
  • Performance will matter in case of Finalize method.

Dispose

  • Dispose Method explicitly called by user and must be implement with IDisposable interface.
  • Anytime we can use this method for any free unmanaged resources such as files, variables, database objects & connections
  • It is associated to IDisposable interface.
  • Performance will not matter in case of Dispose method.

In this article i try to explain Finalize & Dispose Method difference. i hope this information will help you to understand the difference between both of them still if you have any query then you can post your feedback or comment.

No comments:

Post a Comment