I have the following code:
for (int i = 0; i < 10000; i++ )
{
list.Add(new Point(i, 3));
}
for (int i = 0; i < 10000; i++)
{
list[i].X = 100;
}
Point point = new Point(0, 1);
point.X = 1;
point.Y = 10;
When I try to change X or Y property of a newly created Point structure there is no problem:
Point point = new Point(0, 1);
point.X = 1;
point.Y = 10;
But when I'm trying to do the same in a loop
for (int i = 0; i < 10000; i++)
{
list[i].X = 100;
}
The compiler is telling me
Cannot modify the return value of
System.Collections.Generic.List<System.Windows.Point>.this[int]
because it is not a variable
Can anybody please explain me this.