About Destructor in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

About Destructor in C#

When the destructor is working? When we assign the null to object or when the execution of main method is finished?

16th Jan 2018, 7:38 PM
Yusuf
Yusuf - avatar
3 Answers
+ 2
It is run when the garbage collector deletes the object or when the program exacution finishes. Note when the program closes a specific amount of time is allocated for objects to be cleared before exacution is cut off.
16th Jan 2018, 7:48 PM
josh mizzi
josh mizzi - avatar
16th Jan 2018, 9:24 PM
josh mizzi
josh mizzi - avatar
0
How can I delete an object? @josh mizzi
16th Jan 2018, 9:13 PM
Yusuf
Yusuf - avatar