I know a few differences,
- Value types are stored on the stack where as reference types are stored on the managed heap.
- Value type variables directly contain their values where as reference variables holds only a reference to the location of the object that is created on the managed heap.
Is there any other difference i missed… If so,what are they?
Please read: The stack is an implementation detail, and don’t ever again repeat the canard that stack allocation is what differentiates value types from reference types in .NET. The CLR may choose to allocate a variable anywhere it wants to.
The most important difference is in the assignment semantics. When you assign a value type to a variable (or pass it to a method as an argument), all of the data is copied. When you assign a reference type, only a reference is copied – both references point to the same object instance in memory.