What are the fundamental differences between value types and reference types?
C# divides types into two categories - value types and reference types. Most of the basic intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, interfaces, arrays and strings. The basic idea is straightforward - an instance of a value type represents the actual data (stored on the stack), whereas an instance of a reference type represents a pointer or reference to the data (stored on the heap).
The most confusing aspect of this for C++ developers is that C# has predetermined which types will be represented as values, and which will be represented as references.
Hi,
Good post..
Very Useful..
Thanks a lot for posting it..!!
Regards,
Deepika