怎么定义长度不定 的数组
【求助】如何定义长度不定 的数组?各位大佬,我想用GUI+下面的graphics.DrawClosedCurve(Pen, PointF []) 函
【求助】如何定义长度不定 的数组?
各位大佬,
我想用GUI+下面的graphics.DrawClosedCurve(Pen, PointF []) 函数画个封闭曲线,但是我不知道PointF[]这个数组的长度,必须在运行的时候才知道长度。
这个数组怎么定义? 可变长度的数组 DrawClosedCurve
[解决办法]
List<PointF> lpf = new List<PointF>();
lpf.Add(........);
g.DrawClosedCurve(pen, lpf.Select(x => new PointF(x.X, x.Y)).ToArray());
[解决办法]ArrayList List = new ArrayList();
for( int i=0;i<10;i++ ) //给数组增加10个Int元素
List.Add(i);
Int32[] values = (Int32[])List.ToArray(typeof(Int32));//返回ArrayList包含的数组