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

How can I get the ascii code for a character in c#?

1001


What is the purpose of a console table?

902


How to put assembly in gac?

861


who is a protected class-level variable available to?

963


What is a derived class in c#?

1041


How do you sort an array in c#?

922


What is the difference between serialization and deserialization in c#?

948


Why do we need static in c#?

898


Explain the different types of delegates used in c#.

887


Do we get an error while executing the “finally” block in c#?

885


Explain nullable types in c#?

915


in the nunit test framework, which attribute must adorn a test class in order for it to be picked up by the nunit gui?

1103


What is an iqueryable in c#?

859


How long has c# been around?

922


How can you set image source dynamically from c# application to ”test.png” file?

1019