1. The CLR supports two types: reference types and value types .
2. Most of the types in the FCL are reference types , but the most used in a program are value types .
" Reference type "
- The memory must be allocated from the managed heap.
- Each object allocated on the heap has an additional member that must be initialized.
- Other bytes on the object (set for the field) are always set to zero.
- When an object is allocated from the managed heap, a garbage collection operation may be enforced.
" Value type "
- Instances of value types are generally allocated on the thread stack.
- A variable of an instance of a value type that does not contain a pointer to an instance. The variable itself contains a field.
- instances of value types are not controlled by the garbage collector, easing the pressure in the managed heap and reducing the number of times the application is garbage collected during the lifetime.
- Value types are sealed (sealed) to prevent a value type from being used as a base type for any other reference or value type.
Read the Classics-"CLR via C #" (Jeffrey Richter) Notes _ reference type and value type (i)