Region Directives

Visual Basic provides an efficient way of organizing your code within regions. A region is a collapsible area of the code editor that can contain any code and that takes advantage of the outlining feature of Visual Studio 2015. You define a region with #Region..#End Region directives. The following code snippet shows how to define a region:

#Region "Private Members"    Private firstItem As String    Private secondItem As Integer#End Region

The #Region directive requires you to specify a descriptive caption. After you declare regions, you can then collapse them by clicking the - (minus) symbol on the left of the #Region directive. When it is collapsed, the region shows just the descriptive caption; ...

Get Visual Basic 2015 Unleashed 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.