Why does my collection change according to where I declare a variable in a recursive procedure?
<p>In the code below, the StylusPointCollection (SPC) changes according to whether I declare the StylusPoint variable inside or outside the method (i.e. if I comment the internal definition and uncomment the commented lines) .  I don't understand why this is.</p>

<pre><code>//StylusPoint spXY;

private void DrawBinaryTree(int depth, StylusPoint pt, double length, double theta)
{        
    if (depth &gt; 0)
    {    
        StylusPoint spXY = new StylusPoint(pt.X + length * Math.Cos(theta) * Math.Cos(a), pt.Y + length * Math.Sin(theta) * Math.Sin(a));

        //spXY = new StylusPoint(pt.X + length * Math.Cos(theta) * Math.Cos(a), pt.Y + length * Math.Sin(theta) * Math.Sin(a));

        SPC.Add(pt);
        SPC.Add(spXY);

        DrawBinaryTree(depth - 1, spXY, length * lengthScale, theta + deltaTheta);
        DrawBinaryTree(depth - 1, spXY, length * lengthScale, theta - deltaTheta);
    }
}
</code></pre>

<p>I have tried and failed to come up with a more simple example using LinqPad.</p>
