G
Guest
I would like to add a value to my ArrayList. When I add u to orderedpair
below I get the same data for each. I know why, I am Add ing u. I want to
add the VALUE of u at the point in the for loop, NOT q.
Does anyone know how to do this?
for (int q = 0; q < orderedlistx.Count - 1; q++)
{
u.Start = (int)orderedlistx[q];
u.End = (int)(orderedlistx[q+1])-1;
orderedpair.Add(u);
}
below I get the same data for each. I know why, I am Add ing u. I want to
add the VALUE of u at the point in the for loop, NOT q.
Does anyone know how to do this?
for (int q = 0; q < orderedlistx.Count - 1; q++)
{
u.Start = (int)orderedlistx[q];
u.End = (int)(orderedlistx[q+1])-1;
orderedpair.Add(u);
}