I'm trying to convert a two dimensional string array to a two dimensional int array:
int[][] inner = new int[4][];
string[][] arr = new string[4][]
{
new string[] {"11"},
new string[] {"12"},
new string[] {"21"},
new string[] {"22"}
};
for (int i = 0; i < arr.Length; i++)
{
string name = string.Join(".", arr[i]);
for (int j = 0; j < name.Length; j++)
{
inner[i][j] = Convert.ToInt32(name.Substring(j,1));
}
}
But I'm getting the following exception:
Object reference not set to an instance of an object
at:
inner[i][j] = Convert.ToInt32(name.Substring(j,1));