I am needing to iterate an array of points, but I am getting a compile error of:
Operator '<' cannot be applied to operands of type 'int' and 'method group' WindowsFormsApplication1
Point[] points = new Point[] { new Point { X = 50, Y = 40 } } };
for (int i=0;i<points[i].Count;i++)
{
MessageBox.Show(points[i].X);
MessageBox.Show(points[i].Y);
}
your syntax for the second expression in the for loop is incorrect. But really, a foreach
makes more sense here:
Point[] points = new Point[] { new Point { X = 50, Y = 40 } } };
foreach(var point in points)
{
MessageBox.Show(point.X);
MessageBox.Show(point.Y);
}