the link is passed by value.
Arrays in .NET are an object on the heap, so you have a link. This link is passed by value, which means that changes to the contents of the array will be visible to the caller, but the reassignment will not:
void Foo(int[] data) { data[0] = 1;
If you add the ref modifier, the link passed by reference - and the caller can see either the change above.
Marc Gravell Jun 08 '09 at 22:47 2009-06-08 22:47
source share