First, I would change your ArrayList to a strongly typed generic list, List<CurvePoint>
. Then, to get your Point array, you can perform this code.
Point[] Plots = _Data.Select(obj => (Point)obj).ToArray();
If you leave it as an ArrayList, you can still do it using this code:
Point[] Plots = (from CurvePoint obj in _Data select (Point)obj).ToArray();
// or
Point[] Plots = _Data.Cast<CurvePoint>().Select(obj => (Point)obj).ToArray();
Edit: Finally, if you're stuck with ArrayList and you do not have LINQ, you can do this the "long" way.
Point[] Plots = new Point[_Data.Count];
for (int i = 0; i < _Data.Count; i++)
{
Plots[i] = (Point)(CurvePoint)_Data[i];
}
Anthony Pegram
2010-10-07 18:07:43