+ 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?
3 odpowiedzi
+ 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.
+ 1
Look up the dispose design pattern.
https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose
0
How can I delete an object? @josh mizzi