VB.NET Type System

In VB.NET, there is a fundamental distinction between value types and reference types. Value types have storage allocated immediately on the stack when the variable is declared. Reference types have storage allocated on the heap when they are instantiated, not when they are just declared, and the variable is only a reference to the actual object containing the data.

We have been looking at classes in some detail. A class defines a reference type. In this section we survey the entire VB.NET type system, including simple types such as Integer and Decimal. In VB.NET, a Structure has many similarities to a Class, but it is a value type. This means that assigning from one structure variable to another causes the entire structure ...

Get Application Development Using Visual Basic® and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.