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 is poco proxy? : Entity framework

1005


What is razor code?

1023


What filters are executed in the end?

976


What is entity client data provider? : Entity framework

991


how do you mark a property as required? For example, for a project, the name is a required field.

1002


What is representational state transfer (rest) mean?

937


what is entity framework advantage?

1029


Name a few different return types of a controller action method?

1029


Can a view be shared across multiple controllers? If yes, how we can do that?

1006


mention what is code first approach and model first approach in entity framework?

1060


what is explicit loading?

1065


Can you use Razor code in Javascript in ASP.Net MVC?

1126


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

1100


How does the .net framework 3.0 relate to windows vista?

965


What is the need of Action Filters in ASP.Net MVC

1039