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
Explain how can you clean up objects holding resources from within the code?
What is a thread c#?
Which is faster list or dictionary in c#?
What is property c#?
Is php better than c#?
What is the difference between finalize() and dispose() methods?
What benefit do you get from using a primary interop assembly (pia)?
What is anonymous method in c#?
What are the problem with .NET generics?
What is use of private class in c#?
What are the types of constructors?
What are the namespace level elements?
Could you explain the difference between func vs action vs predicate?
What are synchronous and asynchronous operations?
What is string interpolation in c#?