Parameter Array As Reference C# with Example
using System; namespace CSharpFundamentals { class ParameterArrayAsReference { private static void Main(string[] args) { int [] valArray = { 10, 20 }; Console.WriteLine("Before Method Call: val1: {0} \t val2: {1}",valArray[0], valArray[1]); AddList(ref valArray); Console.WriteLine("After Method Call: val1: {0} \t val2: {1}",valArray[0], valArray[1]); } static void AddList(ref int[] intVals) { int [] newArray = {12, 32}; intVals = newArray; } } }