Value types
Value types store data. These are allocated on the stack. E.g. int, bool, structs, enums, float, decimal
Declaration is enough to allocate space for value type.
More reading:
Reference types
Conceptually same as pointers. They store reference to actual data and not the data. E.g. String, Class types such System.IO.StringReader, user defined classes, etc.
Important to note that all arrays are references even if defined type of array is of value type. Using new keyword is essential to initialize and allocate space for reference types.
More reading:
More interesting reading:
HTH.
No comments:
Post a Comment