Consider:
private Double A = 1;
private Double C = 1;
private Double[,] B = new double[2, 2];
private Double[,] e = new double;
private Double[,] D = new double[2, 2];
private void test(ref double A, ref double[,] B, double C, double[,] D)
{
A = 0;
C = 0;
B[1, 1] = 0;
D[1, 1] = 0;
}
After the test sub executes, everything is changed but "C". Clearly, array names are references themselves ("pointers" is a better term).
2 questions:
Under what circumstances might one pass an array as ref double[,] instead of simply double[,]?
Is making a copy of an array the only way to protect an array from being overwritten?
