Export (0) Print
Expand All

7. Types

Visual Studio .NET 2003

The two fundamental categories of types in Visual Basic .NET are value types and reference types. Primitive types (except strings), enumerations, and structures are value types. Classes, strings, standard modules, interfaces, arrays, and delegates are reference types.

With two exceptions, all types are either value types or reference types.

  • The root type Object, which is an alias for System.Object, is a MustInherit type that is neither a reference type nor a value type. Thus, a variable of type Object can either contain a value type or a reference type.
  • The type System.Void, which represents a void type in the .NET Framework, can be referenced only in GetType expressions.

Every type has a default value, which is the value that is assigned to variables of that type upon initialization.

TypeName ::=
   NamespaceOrTypeName |
   BuiltInTypeName |
   ArrayTypeName
BuiltInTypeName ::= Object | PrimitiveTypeName

See Also

7.1 Value Types and Reference Types | 7.3 Primitive Types | 7.4 Enumerations | 7.6 Structures | 7.5 Classes | 7.7 Standard Modules | 4.3.2 Interfaces and Multiple Inheritance | 7.9 Arrays | 7.10 Delegates | Data Type Summary (Visual Basic Language Reference) | Value Types and Reference Types (Visual Basic Language Concepts)

Show:
© 2014 Microsoft