Difference between revisions of "Useful Visual Studio Features"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Colours)
(Added a keybinding section)
Line 13: Line 13:
 
==Intellisense==
 
==Intellisense==
  
Intellisense is the autocomplete function of visual studio. It is possible to gain access by pressing control space when part way through typing, this will display all possible finishes. To navigate and finish press up, down and tab. Double pressing tab allows the implementing of a template example, this is useful when creating custom exceptions or for loops.
+
Intellisense is the autocomplete function of visual studio. It is possible to gain access by pressing control space when part way through typing, this will display all possible finishes. To navigate and finish press up, down and tab. Double pressing tab allows the implementing of a template example, this is useful when creating custom exceptions or for loops. Another feature is rename. Right click on the point where a variable is defined, click rename and all uses will be correctly renamed
 +
 
 +
==KeyBindings==
 +
 
 +
There are many useful keybindings, many of which are common such as control + f to find all and gain access to replace.
 +
 
 +
Control + K: This allows additional commands.
 +
Control + C after control + K: Comment out the selected section.
 +
Control + U after control + K: Uncomment out section.

Revision as of 21:16, 5 March 2017

Breakpoints

Visual studio allows the use of breakpoints which pauses the program once the code has reached that line, once a breakpoint has paused the program it is possible to see what is stored in each variable. This is extremely useful for large programs when running into null exceptions, as it displays which variable is null. After using a breakpoint the tool bar at the top will allow the code to run one line at a time. To place a breakpoint click on the bar left of the numbers until a large red circle appears.

Colours

Visual studio includes the ability to colour certain code, this is useful for programs that have a lot of similar names. An example of the colouring is when declaring a variable:

int i = 0;

would have int coloured as blue much like the "syntaxhighlight" feature, by default this is customisation from properties. While this may not seem useful when the extent of a program is reading and writing to consoles, it is extremely useful when using custom namespaces with their own functions and methods.

Navigation

Visual studio contains some useful features when going through code to follow what is happening. The two most used features are go to/peek definition and go to implementation. Go to definition goes straight to where something is initially defined, whether it is a variable or a function, on the other hand peeking definition places a small window within the screen that shows the same as the definition. Go to implementation reveals every instance of where a variable or function is used, it is possible to go to them by double clicking.

Intellisense

Intellisense is the autocomplete function of visual studio. It is possible to gain access by pressing control space when part way through typing, this will display all possible finishes. To navigate and finish press up, down and tab. Double pressing tab allows the implementing of a template example, this is useful when creating custom exceptions or for loops. Another feature is rename. Right click on the point where a variable is defined, click rename and all uses will be correctly renamed

KeyBindings

There are many useful keybindings, many of which are common such as control + f to find all and gain access to replace.

Control + K: This allows additional commands. Control + C after control + K: Comment out the selected section. Control + U after control + K: Uncomment out section.