- Value Types
- Value types hold the data directly.
- Value types do not have default value.
- Value types will be stored in stack memory at compile time.
- Stack is faster in accessing
- Stack is not accessible to garbage collector. Hence it will not be cleared at runtime.
- Value type passes an exact copy to methods.
- Example: Implicit Data Types, Structures, Enumerations.
- Reference Types
- Reference types do not hold the date directly.
- Reference types have default value.
- Reference types will be stored in heap memory at run-time.
- Heap is slower in accessing.
- Heap is accessible to garbage collector. Hence at run-time heap can be cleared.
- Reference types passes a reference (handle) to methods.
- Example: Classes, Objects, Arrays, Delegates, Interfaces.
Read about Data types
No comments:
Post a Comment