Assuming I have a method in my command architecture pattern that alters the contents of graphics path like so: (GraphicsPath is IDisposable)
(this is purely an untested, quick example)
public void DoSomething(ref GraphicsPath path)
{
if(path != null)
{
List<PointF> pts = new List<PointF>();
foreach(PointF pt in path.PathPoints)
{
//again, just a silly example.
float y = pt.X;
float x = pt.Y;
pts.Add(new PointF(x, y));
}
path.Dispose(); //<-- Do I need this?
path = new GraphicsPath(pts.ToArray(), path.PathTypes);
}
}
Do I need to dispose the path before setting the path equal to the new path? If so, why?