If we not suppress finalize method in dispose what will happen?
Answer Posted / seema dalal
Dispose methods can be called automatically, if client
forget to call it.
for this ,Call the Dispose method in Finalize method and in
Dispose method suppress the finalize
method using GC.SuppressFinalize. Below is the sample code
of the pattern. This is the
best way we do clean our unallocated resources and yes not
to forget we do not get the hit
of running the Garbage collector twice.
Public Class ClsTesting
Implements IDisposable
Public Overloads Sub Dispose()Implements IDisposable.Dispose
' write ytour clean up code here
GC.SuppressFinalize(Me)
End Sub
Protected Overrides Sub Finalize()
Dispose()
End Sub
End Class
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is asp net framework?
What is the purpose of a web form?
How do you assign a value to a complex number 7 how has exception hand changed in .net framework 4.0?
Explain test driven development (tdd) ?
Can you explain model, controller and view in mvc?
What are the main components of .net framework?
Explain Sections is ASP.Net MVC?
What are Scaffold templates in ASP.Net MVC?
How we can handle the exception at controller level in ASP.Net MVC?
How to return the JSON from action method in ASP.Net MVC?
What is viewbag title?
The order of the filters that get executed, if the multiple filters are implemented?
i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?
Why we need a separate mobile project template, while we can render our web application in mobile ?
Which .net framework is installed?