This documentation is archived and is not being maintained.

9.6.3.1 Regular Initializers

Visual Studio .NET 2003

A regular initializer is an expression that is implicitly convertible to the type of the variable. It appears after an equal sign that follows the type name and must be classified as a value. For example:

Imports System

Module Test
    Dim x As Integer = 10
    Dim y As Integer = 20

    Sub Main()
        Console.WriteLine("x = " & x & ", y = " & y)
    End Sub
End Module

This program produces the output:

x = 10, y = 20
RegularInitializer ::= Expression

See Also

9.6.3.4 Array-Element Initializers | 9.6.3.3 Array-Size Initializers | | 9.6.3 Variable Initializers | 4.6 Accessibility | 4.3.3 Shadowing | 9.6 Instance and Shared Variables | 9.6.1 Read-Only Variables | 9.6.2 WithEvents Variables | 11. Expressions | Declarations and Constants Summary (Visual Basic Language Reference) | Variables (Visual Basic Language Concepts)

Show: