Difference between dispose and finallize method?
Answer / Rohit Kandulna
Dispose() is a virtual method that should be implemented by objects to free unmanaged resources they hold, such as file handles or database connections. Dispose() can be called explicitly by the developer at any time. Finalize() is an overridable destructor method in C# that gets called automatically by the garbage collector when the object is about to be destroyed. Its primary purpose is to clean up unmanaged resources that cannot be released through Dispose(). The difference between them lies in when and how they get called: Dispose() can be called at any time, while Finalize() only gets called by the garbage collector during garbage collection.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the differences between user control and server control?
How many types of generations are there in a garbage collector?
What is a manifest in .net?
What is Polymorphism? How does VB.NET/C# achieve polymorphism?
What is a Manifest?
How do you create threading in.net?
What is the difference between Server.Transfer and Response.Redirect?
What is the difference between constants and read-only variables?
What is .net code security?
Different between .net & j2ee ?
What are the different types of assemblies?
What is the lapsed listener problem?