是否有必要这样做 poly = null; ? 完成功能后,垃圾收集器会清理还是?
这里有一个简单的例子:
public void redrawSingelPoly(Canvas canvas)
{
Polyline poly = new Polyline();
poly.Stroke = colorBrush;
poly.StrokeThickness = basicLineThick;
poly.Points = points;
canvas.Children.Add(poly);
poly = null; //Garbage Collector
}