Export (0) Print
Expand All

#Region Directive

Collapses and hides sections of code in Visual Basic .NET files.

#Region "identifier_string"
#End Region

Parts

identifier_string
Required. String that acts as the title of a region when it is collapsed. Regions are collapsed by default.
#End Region
Terminates the #Region block.

Remarks

The #Region directive lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. #Region statements support block semantics (such as #If...#End If), meaning that the start and end must be in the same code block.

Example

This example uses the #Region directive.

#Region "MathFunctions"
' Insert code for the Math functions here.
#End Region

See Also

#If...Then...#Else Directives (Language Reference) | Outlining and Hiding Code | Collapsing and Hiding Sections of Code

Show:
© 2014 Microsoft