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 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.