How to destroy an 开发者_如何学编程object in x++ ?
Objects are automatically destroyed when there are no more references to the object.
This means that if we have a object a
and object b
and b
holds a reference to a
, a
will not be collected as long as b
holds a reference to a
.
If the reference between a
and b
would be removed a
would become eligible for garbage collection, and thus a
will be destroyed in a later stage.
You might want to check out this link: destructors.
精彩评论