If we not suppress finalize method in dispose what will happen?

Answers were Sorted based on User's Feedback



If we not suppress finalize method in dispose what will happen?..

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

If we not suppress finalize method in dispose what will happen?..

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

Post New Answer

More Dot Net Framework Interview Questions

What does a viewmodel do?

0 Answers  


What is the use .glimpse in mvc?

0 Answers  


how to disable the lazy loading framework?

0 Answers   Microsoft,


What are the Core features of ASP.NET MVC?

0 Answers  


How you can implement custom validation in asp.net MVC?

0 Answers  






what is namespace?

9 Answers   TCS,


What are ajax helpers in mvc?

0 Answers  


What are the advantages of razor view engine?

0 Answers  


What is a serverside technology? what is a clientside technology? what is a clientserver technology? what is a internet based application? what is a intranet based application? what is a windows application? what is a console application? Difference between console application and windows application?

4 Answers   IBM,


Is razor a server side?

0 Answers  


What is the difference between partial and renderpartial?

0 Answers  


What is the use of JIT

1 Answers  


Categories