Reputation: 5
I would like to manually change a value of a public variable inside an object that's stored in a multidimensional array. The array is stored in aList<T>
Something like this:
areaList[0].array[90, 50].type = 1;
The code above doesn't work.
The code below works, but doesn't fill the purpose, since I just want to change one variable of a single object stored in the array.
foreach (Area[,] area in areaList]
{
area[90, 50].type = 1;
}
[EDIT] I found out that I could initialize a reference of the object like this:
Area[,] green = areaList[0];
green[90, 50].type = 1;
And thus being able to change the variable-values of the object that's inside the list.
Upvotes: 0
Views: 167
Reputation: 141
use arrayList.get(position) .
areaList.get(0).array[90,50].type=1;
Upvotes: 1