It is important to understand that the destructor is called just prior to garbage collection.It is not called when a variable containing a reference to an object goes out of scope, for example. (This differs from destructors in C++, which are called when an object goes out of scope.) This means that you cannot know precisely when a destructor will be executed. Furthermore, it is possible for your program to end before garbage collection occurs, so a destructor might not get called at all.
Garbage Collection and Destructors
精选 转载文章标签 职场 休闲 Garbage Collection Destructors 文章分类 .Net 后端开发
