Introducing Value Types and Reference Types

Value types are data types that store data directly. Examples of value types are integers (System.Int32), Booleans (System.Boolean), and bytes (System.Byte). Value types are stored in a memory area called the 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 that contains a value:

Dim anInteger As System.Int32 = 5

Reference types are data types that, as their name implies, just reference 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 2015 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.