I have this code:
after the code goes through func2(), a[0] is still "undefined". Shouldn't a[0] be an instance with property member1 equaling to "hello"? I'm confused here.Code:private void button1_Click(object sender, System.EventArgs e) { class[] b; b = new class[1]; func(b); } private void func(class[] a) { func2(a[0]); } private void func2(class a) { a = new class(); a.member1 = "hello"; }
I "could" put "ref" in the declaration, but I've always thought that in .net, classes are always passed by reference.




Reply With Quote