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
What is the difference between localization and globalization?
How long the items in ViewState exists?
What describes a query?
9. Why should we hire you over the others waiting to be interviewed?
What are the different types of cookies in asp.net?
What is asp.net with mvc? : Asp.Net MVC
Which property needs to be set for script manager control to extend the time before throwing time out expection if no response is received from the server?
Explain the features that make asp.net more used framework? : asp.net mvc
What is session handling in a webfarm, how it can work with its limits?
1.What r collections? 2.What is .pdb file? 3.Is it possible to provide access to users in master page? 4.What is dirty n Phantom Read(SQL)? 5.What r different isolation levels(SQL)? 6.How to set authentication mode in web.config file?
What is a page life cycle? What are the events in a page life cycle?
What is Difference between Production Serves and Development Servers? And Suppose, m adding/deleting C# file in a project based on the Specific Requirement. These Files are Automatically updated in Production Servers? So Which tool is needed to do This One?
How do you remove duplicates without using remove duplicate stage?
What New Features comes with ASP.NET Web API 2.0?
What is client side state management?