Value, Reference and Dynamic Types

Value types can be assigned a value directly and are stored in the heap.

The heap is memory set aside for dynamic allocation. Unlike the stack, there's no enforced pattern to the allocation and deallocation of blocks from the heap; you can allocate a block at any time and free it at any time.

Reference type contains a reference to the variables it does not contain actual data and are stored in the stack.

The stack is the memory set aside as scratch space for a thread of execution. The stack is always reserved in a LIFO (last in first out) order; the most recently reserved block is always the next block to be freed.

Dynamic types are dynamic and type checking for this types takes place at run-time.

**Value Type**
int, enum , byte, decimal, double, float, long

**Reference Type**
string , class, interface, object

results matching ""

    No results matching ""