+ 3

Is it necessary to use destructor when you have garbage collector in dotnet?

21st Dec 2016, 12:31 PM
الواجد
الواجد - avatar
5 odpowiedzi
+ 3
It is necessary ONLY if your class has objects like pointers, file handles, network connections etc which are "unmanaged resources" and therefore aren't managed by the .net garbage collector, therefore should be dealt with by using finalizers (like destructors), though in updated versions of .not you have other ways of dealing with them.
21st Dec 2016, 10:59 PM
Yuval Keren
Yuval Keren - avatar
0
NO. But you can use if it is required.
23rd Dec 2016, 9:46 AM
prem
0
no garbage collector do it for u, but can call it manually if u want
23rd Dec 2016, 11:41 AM
Amit Kala
Amit Kala - avatar
0
No it is not mandatory but if you have pointers,unmapped resources you have to think about it...!
24th Dec 2016, 6:05 AM
Ankur Suhane
Ankur Suhane - avatar
0
😊😊
24th Dec 2016, 3:09 PM
mario mikel
mario mikel - avatar