Interview Question
Qus: Explain the differences between value type and reference type.
Following are the main differences between value type and reference type:
o Value type contain variable while reference type doesn't contain value directly in its memory.
o In reference type, memory is allocated in managed heap and in value type memory allocated in stack.
o Reference type ex-class value type-struct, enumeration
Answers (2)
o Value type contain variable while reference type doesn't contain value directly in its memory.
o In reference type, memory is allocated in managed heap and in value type memory allocated in stack.
o Reference type ex-class value type-struct, enumeration
2) Value Type variables are stored in the stack while Reference Type variables are stored in the heap.