The Visual Studio editor provides many features that make it easier for you to write and manage your code and text. You can expand and collapse different blocks of code by using outlining. You can view your code in a number of different ways.
By default, Solution Explorer shows your code organized by files.
You can click on the Class View tab at the bottom of the window to view your code organized by classes.
The following are the most commonly used editor features.
In Visual Studio, some syntax elements of code and markup files are colored differently to distinguish them.
usingin C# and
Importsin Visual Basic are one color, but types such as
Uriare another color.
You can see the default color for each type, and you can change the color for any specific syntax element by clicking Tools > Options, and then selecting Environment > Fonts and Colors.
When you write code and build your solution, you may see different-colored wavy underlines also known as squiggles or light bulbs appearing in your code.
When the insertion point is placed on an open brace in a code file, both the open and closing braces are highlighted.
The dotted lines connect matching braces in code files, making it easier to see the opening and closing brace pairs.
You can turn these lines on or off with the Show structure guide lines option on the Tools > Options > Text Editor > General page.
Line numbers can be displayed in the left margin of the code window. They are not displayed by default. You can turn this option on Tools > Options > Text Editor > All Languages.
The color of the left margin allows you to keep track of the changes you have made in a file.
To turn this feature on or off, change the Track changes option on Tools > Options > Text Editor.
You can select text either in the standard continuous stream mode or in the box mode, in which you select a rectangular portion of text instead of a set of lines.
You can zoom in or out in any code window by pressing and holding the Ctrl key and moving the scroll wheel on the mouse. You can also use the Zoom box in the lower-left corner of the code window to set a specific zoom percentage.
You can move around in the code editor in several different ways.
Including navigating backward and forward to previous insertion points.
Viewing the definition of a type or member, and jumping to a specific method using the navigation bar. We will discuss it further in the Code Navigation article.