There can be at most one destructor. Also see Destructor Syntax in C# and C++ which says "Managed code does not support anything similar to C++ destructor semantics.". The C# language and .Net uses garbage collection, to make programming easier. As a result, destruction can be very confusing and difficult to get right without spending a lot of time studying how to do it.
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.
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