C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
So: When SPECIAL is equal to 1, the variable "a" is assigned to the value 2. Other values of SPECIAL do not have this effect.
Example: We use preprocessor directives, which begin with the pound character "#". These directives start at the first character in a line.
Info: They are not the same as the Const and If keywords used in compiled VB.NET code.
ConstIf ThenVB.NET program that uses directives
#Const SPECIAL = 1
Module Module1
    Sub Main()
        ' Local variable.
        Dim a As Integer = 1
        ' Use special value is SPECIAL is 1.
#If SPECIAL = 1 Then
        a = 2
#End If
        ' Display value.
        Console.WriteLine(a)
    End Sub
End Module
Output
2
Also: Regions are used by Visual Studio when auto-generation of code files is performed, as for Windows Forms.
Note: Regions in VB.NET cannot be used in all locations. They must enclose an entire Function body or other unit of code.
VB.NET program that uses Region
Module Module1
#Region "INIT"
    ''' <summary>
    ''' Initialize the program.
    ''' </summary>
    Sub Main()
        Console.WriteLine("A")
        Console.WriteLine("B")
        Console.WriteLine("C")
        Console.WriteLine("Copyright 2017")
    End Sub
#End Region
End Module
Output
A
B
C
Copyright 2017
And: With preprocessing directives, no performance loss is incurred with branches of an #If. The branches are handled before execution.
Caution: One problem with preprocessing directives is bit rot. Code that is not compiled because of an #If may become buggy or invalid.