Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Dear All,
I have a basic knowledge regarding Stack and Heap, and I know all value type will be stored in stack and reference type in heap. But if I have a value type inside a class then where it will be stored? How this will work inside the memory?
-Manu
Posted
Comments
PIEBALDconsult 21-Sep-15 1:09am    
"I know all value type will be stored in stack"
That's where you're wrong.
Manu Prasad 21-Sep-15 1:16am    
Yes, but all most all articles available on web are wrong about this :). And if I am wrong then what is the difference between value type and reference type? Only copied by value and copied by reference ?

1 solution

Value types are stored in the stack though there are conditions.
These articles should help you understand a little bit about value types -
The truth about value types[^]
Six important .NET concepts: Stack, heap, value types, reference types, boxing, and unboxing[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900