memory management for a value and reference type
I have searched about the subject of reference type vs value type in C#
and data allocation in stack and heap.
From these sources , stackoverflow question and this article, I make this conclusion :
I have few questions :
Why it is recommended to write this :
public class OurClass()
{
public ClassA objA;
public OurClass()
{
objA = new ClassA();
}
}
Instead of writing
public class OurClass()
{
public ClassA objA = new ClassA();
public OurClass()
{
}
}
Did it have relation with allocation performance?
Thanks,
链接地址: http://www.djcxy.com/p/82602.html上一篇: JVM如何为静态字符串变量分配内存?
下一篇: 内存管理的值和引用类型