If we not suppress finalize method in dispose what will happen?
Answers were Sorted based on User's Feedback
Answer / answerme
If we do not suppress finalize method in dispose, the
finalise method will be called twice by the garbage
collector. Once the method that is called by the developer
and once when the GC runs for checking the object that are
out of scope. This hampers the performance and is heavy on
performance.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
What platforms does the .NET Framework run on?
What are the types of assemblies and where can u store them and how ?
11 Answers Accenture, BirlaSoft, IBM,
Why is entity framework used?
What is difference between constants, readonly and, static
What is .net framwork? what is web application? what is CLR? How does work CLR & wht is work of CLR? What is compile? wht is thread? what does use in .net?
Can you please explain the request flow in ASP.NET MVC framework?
what is minimum requirement for entity framework applications to run?
Is http stateful or stateless?
What is rxjava used for?
explain why t4 entity is important in entity framework?
What are Satellite Assemblies? How you will create this?
How large is the .net framework 3.0? Does this change make the release larger?