Question & Additional Information
 
What is a destructor?
Add to My IQ
 

 | 
Inappropriate
Answer Title
Answer
A C# destuctor is not like a C++ destructor. It is actually an override for Finalize(). This is called when the garbage collector discovers that the object is unreachable. Finalize() is called before any memory is reclaimed.
Question Tag Title
Tags
Question Asked At Title
Asked At
None
Question Job Title
Job Titles


Check out our newest job listings!

Post a Job! $49 for 60 days



Your Name:
Add your comment text
 
Related Questions
Related Questions
Flag this interview question as inappropriate Inappropriate
See Answer
Constructor or destructor inheritance is explicit.. Public Extended : base()à this is called the constructor initializer.
Create Date
:
Tuesday, May 13, 2008
Tags
:
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
Like a Java Virtual Machine, the CLR removes the burden of memory management from developers by destroying objects once they are no longer being referenced. Before an object is removed from memory, it must free any resources it has allocated during its lifetime. In C++, this "cleanup code" is usually housed in an object's destructor, whereas in VB it is placed in the Class Terminate () method. Under the .NET Framework, cleanup code must reside in an object's Finalize () method, which is called just before the object is garbage-collected by the CLR. Finalize () is a method in the System.Object class from which all other .NET classes derive. You only have to override this method when you have cleanup code that should be performed before the class is destroyed. For performance reasons, the Finalize () method should only be employed when efficiently freeing a particular resource is a prime concern.
Create Date
:
Saturday, May 10, 2008
Tags
:
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
In order to understand the "finalize" method one needs to understand the concept of garbage collection.  The job of freeing up the memory allocated to objects is that of a garbage collector. When the garbage collector determines that an object is no longer referenced it automatically runs a special destructor function called "Finalize". However we have no way to determine when the garbage collector will call the Finalize method. We can only be sure that it will be called at some time after the last reference to the object is released. Finalize is a protected method i.e. it can be called from the class or derived classes however it cannot be called from outside of the class. If a class has a Finalize method it should explicitly call the Finalize of its base class as well.  Overrides Protected Sub Finalize ()             'Cleanup code goes here             BaseClass.Finalize End Sub
Create Date
:
Saturday, May 10, 2008
Tags
:
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.
Create Date
:
Sunday, April 27, 2008
Tags
:
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
Be the first one to answer the question Click here to answer
Create Date
:
Sunday, March 16, 2008
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
 
• More Related Questions: 
Suggestions & Comments




Share Your Interview Questions
Ask Interview Questions
View Unanswered Questions





Advertise on this site