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...

Does c# supports destructors?

Answer Posted / praveen saxena

Yes and No,
C# supports destructors just to provide a familiar way fo
destructing objects for C++ developers. even syntax also is
same but internally its the dicpose method that does all
the work.

Even if you declare a destructor the compiler automatically
translates a destructor into an override of the
Object.Finalize() method. In other words, the compiler
translates the following destructor:

class Class1
{
~Class1(){}
}

Into the following code:

class Class1
{
Protected override void Finalize()
{
try{..}
finally { base.Finalize();}
}
}

I guess that makes things more clear.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In .NET how can you solve the DLL Hell problem?

1167


Can a class or a struct have multiple constructors?

976


What is #region in c#?

938


What is the difference between const and static read-only?

937


What is the difference between method overriding and method overloading?

952


What is a variable in c#?

907


What is boolean conditions in c#?

969


Explain how do I convert a string to an int in c#?

973


What does the dispose method do with the connection object?

970


What is the use of console application in c#?

926


Is an array an object c#?

936


What does this keyword mean in c#?

912


Can an abstract class inherit from another abstract class c#?

952


Who benefits from ajax?

981


What is xor operator in c#?

951