I'm working in this code for setting values in a specific part of a [5,5] 2D array from keyboard, for example ad an "x" in column 2 row 3, and it's almost done but I keep getting an error. Let´s begin with the part of the code I have problems with:
int[,] data = new int[5, 5];
public void cargar()
{
string[] input = Console.ReadLine().Split('=');
string[] coordinates = input[0].Split(',');
int[] intCoordinates = coordinates.Select(s => int.Parse(s)).ToArray();
data[intCoordinates[0]][intCoordinates[1]] = int.Parse(input[1]);
}
The message refers to the 10th line, it´s about "data" (it´s the name of the array):
"Incorrect index number inside []. 2 was expected".
It´s translated from Spanish, so I think that's what is says. How could I fix this?