OUTLINING
By default, the code editor displays an outline view of code. If you look at the first line in Figure 5-1, you’ll see a box with a minus sign in it just to the right of the line number. That box represents the outlining for the Form1 class. If you click this box, the editor collapses the class’s definition and displays it as a box containing a plus sign. If you then click the new box, the editor expands the class’s definition again.
Near the bottom of Figure 5-1, you can see that the RandomizeArray subroutine has been collapsed. The ellipsis and rectangle around the routine name provide an extra indication that this code is hidden.
The editor automatically creates outlining entries for namespaces, classes and their methods, and modules and their methods. You can also use the Region statement to group a section of code for outlining. For example, you can place several related subroutines in a region so you can collapse and expand the routines as a group.
Figure 5-2 shows more examples of outlining. Line 33 begins a region named Randomization Methods that contains two collapsed subroutines. Notice that the corresponding End Region statement includes a comment that I added giving the region’s name. This is not required but it makes the code easier to understand when you are looking at the end of a region.
FIGURE 5-2: The code editor outlines namespaces, classes and their methods, modules and their methods, and regions.
Line 57 contains a collapsed region named Utility ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access