关于Arrayline的元素 public class Line { public Point StartPoint = new Point(); public Point EndPoint = new Point(); } ArrayList lines = new ArrayList(); Line line =new Line(); line.StartPoint.X = 0; line.StartPoint.Y = 0; line.EndPoint.X = 100; line.EndPoint.Y = 100; lines.Add(line); line.StartPoint.X = 1; line.StartPoint.Y = 1; line.EndPoint.X = 101; line.EndPoint.Y = 101; lines.Add(line); 为什么我这样写 用foreach (Line line in lines)遍历lines或者用for(int i=0;i<lines.Count;i++)遍历lines 取得的line或者lines[i]的都是一样的?
------解决方案--------------------
------解决方案-------------------- Line line =new Line(); ==> line =new Line();