【发布时间】:2015-07-19 15:14:59
【问题描述】:
众所周知,值类型存储在堆栈中。现在考虑一下:
class test
{
public int Sum { get; set; }
public string Name { get; set; }
}
然后创建一个实例如下:
test t = new test();
t.Sum = 10;
t.Name = "a string";
现在,实例及其属性如何存储在堆中? 因为我们有一个 int 应该存储在堆栈中。
【问题讨论】:
标签: c# oop heap-memory stack-memory