Here’s a quick quiz about GC:
Q) At what point is x eligible to be cleaned up by the GC?
<FIELDSET><LEGEND>Garbage Collection</LEGEND>
public void foo()
{
Class1 x = new Class1();
Class2 y = new Class2();
y.Width = x.GetWidth();
y.Height = y.Width;
y.Color = "Red";
}
</FIELDSET>
ANSWER: (highlight the black area to see answer)
<FONT style=”BACKGROUND-COLOR: #000000” color=#000000>After x.GetWidth() is executed</FONT>
See this post’s comments for explanation/discussion…