Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the Difference B/W Finalize() and Dispose() in .Net?

Answer Posted / purushottam kumar, mcad, mcsd

Finalize :
1.Finalize() is called by the runtime
2.Is a destructor, called by Garbage Collector when the
object goes out of scope.
3.Implement it when you have unmanaged resources in your
code, and want to make sure that these resources are freed
when the Garbage collection happens.

Dispose :
1.Dispose() is called by the user
2.Same purpose as finalize, to free unmanaged resources.
However, implement this when you are writing a custom class,
that will be used by other users.
3.Overriding Dispose() provides a way for the user code to
free the unmanaged objects in your custom class.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a code snippet to implement the indentation in json in web api.

1032


What is asp.net web application?

1005


Can we have 2 web config files?

919


Explain the difference between response.redirect vs server.transfer

1104


What is recordset asp?

959


Explain the path instructions in xaml?

952


Which platform does Microsoft .NET use for exchanging data between applications?

1005


Explain difference between dataset and datareader?

993


How to add DateTime Control in normal DataGrid Server Control?

1064


Explain authorization levels in .net ?

1004


What is directive in asp net?

974


Explain the difference between value type and reference type?

613


What do you mean by authentication?

1032


What are the parts of an http response?

922


Define repository pattern in mvc.net? : asp.net mvc

1014