I am pretty sure that I have initialised everything, but it still throws
"Object reference not set to an instance of an object."
Cell[,] cell;
bool[,] UpdateCell;
int AreaSizeX;
int AreaSizeY;
int MaxAge;
public void Reset(int areaSizeX, int areaSizeY, int maxAge)
{
AreaSizeX = areaSizeX;
AreaSizeY = areaSizeY;
MaxAge = maxAge;
cell = new Cell[AreaSizeX, AreaSizeY];
UpdateCell = new bool[AreaSizeX, AreaSizeY];
for (int i = 0; i < areaSizeX; i++)
{
for (int j = 0; j < areaSizeY; j++)
{
cell[i, j].Alive = false; //throws exception here #########
cell[i, j].Age = 0;
UpdateCell[i, j] = false;
}
}
}
What is wrong in this code? C# does not allow dynamic array creation?