liadinon
New member
- Joined
- Jan 5, 2020
- Messages
- 1
- Programming Experience
- Beginner
i have variable store in array when i change the value of the variable it change it on the array, how to prevent this?
all the variables are globals
video that show the problem: 2020-01-05 17-01-16.mp4
the code:
all the variables are globals
video that show the problem: 2020-01-05 17-01-16.mp4
the code:
C#:
callerPieces = new List<string[]>();
for (int x = 0; x < 8; x++)
{
for (int y = 0; y < 8; y++)
{
try
{
if (lastTurnBoard[x, y, 0].Substring(0, 1) == callerColor)
{
callerPiecesItem[0] = x.ToString();
callerPiecesItem[1] = y.ToString();
callerPiecesItem[2] = lastTurnBoard[x, y, 1];
callerPiecesItem[3] = lastTurnBoard[x, y, 0];
callerPieces.Add(callerPiecesItem);
}
}
catch { }
}
}
Last edited by a moderator: