I know a few differences,
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.
Here are some additional differences:
As mentioned by Aaronaught and Eric blog post:
Remember the rule, Reference types always goes to the Heap, whereas Value Types always go where they were declared? If a Value Type is declared outside of a method, but inside a Reference Type it will be placed within the Reference Type on the Heap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With