我要问的问题让我感到困惑,只是因为我正在深入研究一些 C# 细节。考虑以下代码:
public class Node
{
public int Data {get;set;}
}
var a = new Node() { Data = 1 }; // address in memory 0x600000
var b = new Node() { Data = 2 }; // address in memory 0x700000
var c = new Node() { Data = 3 }; // address in memory 0x800000
a = b; // variable a holds a reference to the memory location of b -> 0x700000
b = c; // variable b …Run Code Online (Sandbox Code Playgroud)