Hi...
What is the Constructor and Destructor in C# ? How many type of constructor and Destructor with example ?
Thanks...
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Oct 19, 2011, 1:33 PM
Check out the Collection of Articles :
http://www.c-sharpcorner.com/Search/?sKeywords=Constructor+and+Destructor+in+C#
Vineet Kumar SainiPosted Nov 26, 2011, 5:54 AM
Satyapriya NayakPosted Oct 19, 2011, 10:33 AM
Please refer Our recommended articles section.
Thanks
Sam HobbsPosted Oct 18, 2011, 2:27 PM
The important thing is that most classes do not need a desctructor. There is also the IDisposable inerface and the Finalize method; they are also not needed for most things. Also, developers experienced with C++ but not C# have a tendency to call GC.Collect when they don't need to.
The most likely palces that things like that are needed is when a class calls unmanged code. Managed classes will take care of themselves.
I assume you are familiar with C++, which is very precise about destruction. C# is quite imprecise about destruction and you must accept that.
VulpesPosted Oct 18, 2011, 2:10 PM
Javeed M ShaikhPosted Oct 18, 2011, 1:21 PM
Please refer to this article on C# Corner:
http://www.c-sharpcorner.com/UploadFile/rajeshvs/ConsNDestructorsInCS11122005010300AM/ConsNDestructorsInCS.aspx