Should I write destructors for all the classes
-
Hi Should I write destructors for all the classes or do all classes have destructors by default(In built)
Regards, Sivaprasad
-
Hi Should I write destructors for all the classes or do all classes have destructors by default(In built)
Regards, Sivaprasad
-
Hi Should I write destructors for all the classes or do all classes have destructors by default(In built)
Regards, Sivaprasad
No Need
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
No Need
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
If .net frame work handles this...Y should I write destructors manually in some cases and
Regards, Sivaprasad
-
If .net frame work handles this...Y should I write destructors manually in some cases and
Regards, Sivaprasad
-
Hi Should I write destructors for all the classes or do all classes have destructors by default(In built)
Regards, Sivaprasad
.NET does not have the same concept of destructors as C++ does. The
~T
syntax (for C#) you see (where T is the name of the class) is actually a finalizer. You should almost never need to write a finalizer. What you are probably thinking of is aDispose
method or theIDisposable
interface. Really the only time you need to use this in your own class is when you are managing native resources (unmanaged memory) yourself or you are internally managing a class that implements it. There are a lot of references available, both here on CP and the web. You can check out this article[^] for more information.Scott.
—In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]
-
And how does this answer his question?
Scott.
—In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]