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
How can I get the ascii code for a character in c#?
What is the purpose of a console table?
How to put assembly in gac?
who is a protected class-level variable available to?
What is a derived class in c#?
How do you sort an array in c#?
What is the difference between serialization and deserialization in c#?
Why do we need static in c#?
Explain the different types of delegates used in c#.
Do we get an error while executing the “finally” block in c#?
Explain nullable types in c#?
in the nunit test framework, which attribute must adorn a test class in order for it to be picked up by the nunit gui?
What is an iqueryable in c#?
How long has c# been around?
How can you set image source dynamically from c# application to ”test.png” file?