I have a problem with the code:
namespace hello
{
public class Program
{
public static void Main(string[] args)
{
int xx = 5;
string[,] myArray = new string[1, 5];
if (xx > 4)
{
ResizeArray(ref myArray, 4, 5);
}
else
{
ResizeArray(ref myArray, 2, 5);
}
}
void ResizeArray(ref string[,] original, int rows, int cols)
{
string[,] newArray = new string[rows, cols];
Array.Copy(original, newArray, original.Length);
original = newArray;
}
}
}
I get the error message:
An object reference is required for the non-static field, method, or property 'hello.Program.ResizeArray(ref string[,], int, int)'