views:

88

answers:

1

Is it possible to have a constructor calling a destructor in C#?

+9  A: 

Since there are no destructors in C#, no.

You are probably thinking of the finalizer which is called by the framework, not user code...so again, the answer is no.

If you're talking about the Dispose() method of the IDisposable interface, it is possible to call this.Dispose() from inside the constructor...but it would be pointless to say the least.

Justin Niessner
C# does supports the concept of destructor but the compiler directly the converts the destructors code into an override of Object.Finalize() method.
Adi_aks
For more, refer to this link:- http://www.c-sharpcorner.com/UploadFile/chandrahundigam/UnderstandingDestructors11192005021208AM/UnderstandingDestructors.aspx
Adi_aks