Dispose:
1) Dispose is a method which used to handle resource cleanup in run time environments ,that uses automatic garbage collection
2) Dispose is available with those object which implements IDisposable interface. (Defaulty by framework)
3) Internally, it is called by Garbage Collector and cannot be called by user code.
Finalize:
1) Finalize is used to fire when the object is going to release the memory.We can set a alert message to says that this object is going to dispose
2) Explicitly, it is called by user code and the class implementing dispose method must implement IDisposable interface.
For Example,
If we are opening a file in our application,this will be released in Dispose() method.
Normally before releasing database connection, we have to close the database connection. we have to place the code for Closing the file operation will be taken place in Finalize() method..
Subscribe to:
Post Comments (Atom)
Abstract Factory Vs Factory Method
Abstract Factory Provides an interface for creating families of related or dependent objects without specifying their concrete classes ...
-
Stored Procedures are pre-compile objects which are compiled for first time and its compiled format is saved which executes (compiled code) ...
-
Web API 1. This is the new framework for building HTTP services with easy and simple way. 2. Web API is open source an ideal ...
-
There are many technologies used to build .NET Web applications. To build effective application-level authentication and authorization s...
No comments:
Post a Comment