Visual Studio For Mac Collapse Regions
Ctrl+K Ctrl+0 Fold (collapse) all regions Ctrl+K Ctrl+J Unfold (uncollapse) all regions Ctrl+K Ctrl+C Add line comment Ctrl+K Ctrl+U Remove line comment. Ctrl+M unassigned shortcuts available at Toggle Tab moves focus Search and replace Ctrl+F Find Ctrl+H Replace.
By, published at Visual Studio code regions allow blocks of code to be named and for these blocks to be collapsed to hide their contents. This can be useful for organising your code and hiding areas in the text editor that are not immediately linked to the task in hand.
What is a Code Region? Visual Studio allows the creation of code regions within the code of a program or class library.
A code region is simply a named section of code that can be hidden from view as required. This allows areas of code to be organised. Code regions only affect the manner in which source code is displayed. Download google voice for chrome.
Adding one or more regions has no effect on the final, compiled software. The #region Preprocessor Directive The compiler recognises various. These are commands that are interpreted during the compilation of the program that may affect the compiler's final output. They can also be used to modify the way that code is displayed in the (IDE). Preprocessor directives are identified by a leading 'hash' symbol (#). Two directives are used for code regions.
The first identifies the start of the region and includes the '#region' command and the name of the region being defined. The second, '#endregion' denotes the end of the code region. When a code region is created, Visual Studio automatically places a minus symbol (-) in the margin near the region and a line terminating at the end of the region.
This is the area that the IDE has identified as a region. The image below shows an example region: The minus symbol in the margin can be clicked to collapse the code region.
Once collapsed, the minus is replaced with a plus symbol (+) that can be clicked to expand the code again. Considerations Code regions can be very useful for organising code. However, care should be taken to ensure that code is hidden sensibly. It is possible to hide very small areas with a method. This can lead to the code becoming difficult to read or even misleading when the regions are collapsed. Other Code Regions Visual Studio automatically generates regions for,, and other code structures.
No preprocessor directives are used in these cases. The IDE simply creates the controls in the margin to collapse and expand these areas.
Code folding means You can collapse and expand code fragments by using: • Code folding toggles (, or ). These toggles are shown in the editor to the left of the corresponding folding regions. If a region is unfolded, indicates the beginning of the region while is located at its end. For folded regions, the toggle is shown as. If you hold the Alt key and click, or, the region is collapsed or expanded recursively, i.e.
Along with all its subordinate regions. • Commands of the Folding menu and associated keyboard shortcuts. The Folding menu can be accessed from the main menu bar ( Code Folding), or as a context menu in the editor. The shortcuts are shown right in the menu. See Commands of the Folding menu and associated shortcuts. • Folded fragments themselves: click to expand the corresponding fragment.