Get started with Visual Studio 2017

Editing code

IntelliSense

Visual Studio’s IntelliSense makes coding faster by offering contextual suggestions while you type and lowers your chances of making typos. For example, as you type characters, IntelliSense will show a list of members (variables, methods, etc.) that’s filtered to include only those containing your typed characters. You can use the arrow keys to select one of the suggestions. Pressing Tab will insert the selected member.

List members

For functions, IntelliSense will also list parameter information.

Parameter info

Detecting errors in your code

Squiggles are wavy red lines that appear under potential errors in your code. Hovering over a squiggle gives you information about the error it indicates. A light bulb may appear next to errors and offer quick fixes that Visual Studio can automatically apply.

Squiggles

You can view all errors and warnings in your solution by opening the Error List through View → Error List.

Error list

Formatting code

You can use Visual Studio to automatically format your code so that your code is written consistently. The following two commands explicitly format your code:

  • Format Document (Edit → Advanced → Format Document, or Ctrl + K, then Ctrl + D) – Formats the entire active file
  • Format Selection (Edit → Advanced → Format Selection, or Ctrl + K, then Ctrl + F) – Formats text you’ve selected

Format document

Along with manual code formatting, Visual Studio by default triggers formatting on user gestures such as entering a new line and pasting code. You can change when Visual Studio automatically formats your code for a given language by using the options menu and searching for “Formatting”.

Renaming

Sometimes you don’t get code right the first time – you can use Visual Studio to rename variable or method names and intelligently update all references with the new name. To use this feature, right click the variable or method, and select Rename. Type in the new name and hit Enter to apply your changes.

Rename variable

Learn more

Editing features in Visual Studio - Learn more about the set of code editing features in Visual Studio. Refactoring, Code Generation and Quick Actions in Visual Studio - Learn more about refactoring code in Visual Studio


I ran into an issue Next: Navigating code