Arrays in C# are reference type, and can be passed as arguments to functions. This code assigns a new array object to an array argument inside a function:
class Test {
public void Foo(int[] a) {
a = new int[4];
}
}
// create instance of Test and call method Foo
int[] iArr = new [] { 1,2,3 };
var t = new Test();
t.Foo(iArr);
What will be contents of array - iArr - after the call to t.Foo()?