C# pass by value vs. pass by reference
问题 Consider the following code (I have purposefully written MyPoint to be a reference type for this example) public class MyPoint { public int x; public int y; } It is universally acknowledged (in C# at least) that when you pass by reference, the method contains a reference to the object being manipulated, whereas when you pass by value, the method copies the value being manipulated, thus the value in global scope is not affected. Example: void Replace<T>(T a, T b) { a = b; } int a = 1; int b =