Do we need to set the object to null to invoke the destructor? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Do we need to set the object to null to invoke the destructor?

16th Jun 2016, 5:03 AM
Michael Aries Malaca
Michael Aries Malaca - avatar
2 Answers
+ 2
It depends on if dispose method is available If not you should set it to null. this way you keep low memory consumption and it also help the garbagecollector. im not obsesive but i always try to code with a lot of "using" command. And for the framework stuff use "dispose" for every thing as soon as posible. something like never is the use of "redim"
9th Aug 2016, 10:58 PM
Martin Fisher
Martin Fisher - avatar
+ 1
No
21st Jun 2016, 10:17 AM
Ravil Yahyayev
Ravil Yahyayev - avatar