J
Jon Skeet [C# MVP]
Cor Ligthert said:This is the message from Scott
<snip>
I notice you haven't answered my question.
Where Scott did write about the place it was eligible for the GC?
When the method falls out of scope, it does not always mean that an (in that
method created) object is collectable for the GC, however Scott did not
write that either.
No - but he did write "There are certain circumstances though, when you
may want the object in question to fall out of scope immediately,
rather than waiting for the end of a procedure."
To me, Scott was giving the impression that he believed that local
variables ensured that the objects they had references to were not
eligible for garbage collection until the end of a procedure. That is
not the case, as my reply said.
And that was for me already clear in the explanation from Scott. Why would
it be set to nothing at the end of the procedure (method)
I wasn't talking about setting variables to nothing at the end of the
method. I was talking about setting variables to nothing in the
*middle* of the method, which is pointless if the variable is not used
after that point in the method anyway. That was not clear from Scott's
message.