Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What type of filter does outputcacheattribute class represents?

1081


What is the role of the jit compiler in .net framework?

1096


Why is the .net framework 3.0 a major version number of the .net framework if it uses the .net framework 2.0 runtime and compiler?

1005


What are non action methods in mvc?

1003


explain lazy loading, eager loading, and explicit loading?

998


What is ViewData and TempData in ASP.Net MVC?

1024


Can we add constraints to the route? If yes, explain how we can do it?

1210


How does the .net framework 3.0 relate to the .net framework 2.0?

1031


What is entity sql? : Entity framework

1018


What is the significance of nonactionattribute?

1012


What are the components required to create a route in ASP.Net MVC?

1047


Is .net framework 4.8 the last version?

1027


List out few different return types of a controller action method?

1031


Can I use razor code in javascript in asp.net mvc?

1144


What is meant by viewdata?

960