Say I have a function:
static void foo(int[,] arr, arg1)
{
//say arg1 = row - 1
for(int row = 0; row < arr.GetLength(0); row++)
{
for(int col = 0; col < arr.GetLength(1); col++)
{
MessageBox.Show(arr[arg1 , col]) // should be equal to arr[row-1,col]
}
}
}
foo(arr, "row-1"); // should be equal to arr[row-1,col]
I want to reference the loop variable with arg1.
Is this possible?
What type should arg1 be?
How do i write this?