Value Type |
Reference types |
|
Storage |
Direct store data itself |
The reference data is stored, the data stored in the data heap |
Memory Allocation |
Allocated in the stack |
Allocated on the heap |
effectiveness |
High efficiency, no address translation |
Low efficiency, the need for address translation |
Garbage collection |
Use immediately after recovery |
Not recycled after use immediately, but to the treatment and recovery GC |
Assignment |
Create a new object |
Create a reference |
Type Extension |
Difficult to expand, all value types are sealed (Seal), it is impossible to derive new value type |
Having polymorphic properties to facilitate the expansion |
Examples of distribution |
Usually in the thread stack allocation (the static allocation ), but in some cases it can be stored on the heap |
Always in the process heap allocation (in dynamic allocation ) |
Original link: http://www.cnblogs.com/zengming/p/6037048.html