In .net, the value types are stored on stack where as reference types are stored on managed heap. What is the reason for this one? Is it not possible to exchange their storage locations?
C# – Storage of Value Types and Reference Types in .NET
cnet
cnet
In .net, the value types are stored on stack where as reference types are stored on managed heap. What is the reason for this one? Is it not possible to exchange their storage locations?
Best Answer
The stack is an implementation detail. The important thing is the reference/value distinction.
It's very easy to store value types on the heap.