Sunday, July 27, 2008

Value type Vs Reference Type

Value Type
  1. It stores value directly.
  2. It consists of two categories, Structs, Enumerations
  3. It cannot assign to a null value.
  4. Each instance of value type separate memory is allocated.
  5. Stored in stack
Reference Type
  1. It stores reference to value.
  2. It consists of Class, interfaces, delegates.
  3. It can assign a null value.
  4. It utilizes the same memory location
  5. Stored in heap, by doing this it allows object to be allocated or deallocated in random order at the same time it has an overhead of a memory manager and garbage collector to remove the objects that has been not used for long time.

Techno Zone