// When using OUT it will not require this. // This means that you will not be able to assume that the parameter has already been populated. // You will not be able to read its value inside the method. public static string ArrayAsOutPassing(int[,] arr) { ArrayTest.FillIntArray(arr); ArrayHelpers.PrintArray(arr); int[,] arrCpy = arr; ArrayHelpers.UpdateArrayAsOutPassing(out arr); bool result = IsChanged.IsNumericArraysEqual(arr, arrCpy); return(String.Format("If array was passed into func with OUT parameter and had been changed there" + "then it is NOT going to be changed everywhere. It is {0}", result)); }
// II.1.C With OUT parameter public static void UpdateArrayAsOutPassing(out int[,] arr) { // In this method we not be able to read ARR value. Thet's why we initialize it again arr = new int[5, 2]; ArrayTest.FillIntArray(arr); }