【发布时间】:2014-01-02 03:12:23
【问题描述】:
我是 C# 新手,现在处于学习阶段。我对引用和值类型感到困惑。我对此进行了谷歌搜索,但没有找到让我理解的答案。
这是我的课。我想知道所有这些类型是如何存储在堆/堆栈中的。
class Demomemory
{
int var ;
string strVar ;
public DemoClass DC = new DemoClass(); //Another class object
public Demomemory(int x ,int y)
{
int z = x+ y ;
}
}
谁能告诉我上面的变量(var、strVar、DC、x、y、z)是如何存储在内存中的。 我通常会看到一些语句,例如 DC is reference to the actual object 。这个参考到底是什么。
我是 c# 新手,所以请帮助我。提前致谢。
【问题讨论】:
标签: c# memory reference heap-memory stack-memory