Introducing Value Types and Reference Types

Basically value types are those data types that store their data directly. Examples of value types are integers (System.Int32), Boolean (System.Boolean), and bytes (System.Byte). Value types are stored in a memory area called Stack. They are represented by (and defined via) structures that are enclosed in Structure..End Structure code blocks. The following is an example of a value type containing a value:

Dim anInteger As System.Int32 = 5

Reference types are instead data types that, as their name implies, are just a reference to the actual data. In other words, reference types store the address of their data in the Stack whereas the actual data is stored in the managed Heap. Reference types are represented ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.