I have a function that returns index of an 2d array like this
public int[] getIndex()
{
return new int[2] { i, j };
}
I want to be able to use this function to directly access the value of the 2d array, so for example
var val = array[getIndex()]
But the getIndex() throws an error. Is there any other way I can return a key for a 2d array? or do I have to manually specify
var val = array[getIndex()[0], getIndex()[1]]