I will first show you my code because I'm having a hard time finding words to explain what I want, I have a List of Points which contains coordinatesList<PointF> points;
, they are 20 coordinates to be exact. I want to separate those 20 points into 4 List of Points. This are my 4 List of Points:
List<PointF> Col1 = new List<PointF>();
List<PointF> Col2 = new List<PointF>();
List<PointF> Col3 = new List<PointF>();
List<PointF> Col4 = new List<PointF>();
This is my code :
int loop = 1;
while (loop <= 20)
{
var identifier = 1;
if (loop % 5 == 0)
{
identifier++;
}
else
{//Here is what I'm talking about, if I want it to be like Col1 + identifier.ToString(), something like that
Col.Add(new PointF(points.ElementAt(loop - 1).X, points.ElementAt(loop - 1).Y));
}
}
What i want to do is if my loop is already at 5 I want my Col1.add to be "Col2.add" and if my loop is equal to 10, I want my Col2.add to be "Col3.add" and if my loop is equal to 15, I want my Col3.add to be "Col4.add". I dont know how to say this but, I want to increment my List names.
I want something like this, but it is with 20 PictureBox and not with variables.
for (int x = 1; x <= ExtractedBoxes.Count(); x++)
{
((PictureBox)this.Controls["pictureBox" + x.ToString()]).Image = ExtractedBoxes[x - 1];
}