Visual Studio features and shortcuts are very important when you are developing in Visual Studio. These features help in developing faster. These shortcuts & features will enhance your interaction with Visual Studio and will make your life easier.
Let's start with the start page of Visual Studio. On the top of the start page there is an option to "Send Feedback." Selecting that option you can either "send feedback," you can "report any problem" related to visual studio, or you can "rate the product." Here in the screenshot you can find this option very easily.
Start Page
Task List
Task List specifies the tasks that you have to perform later or you have saved as a reminder what you will perform on next day.
From the Menu go to "View", then "Task List" or (Ctrl+\, T)
How to assign tasks for yourself or anyone else in Visual Studio // TODO - syntax the tasks that you have to perform and then you can see those tasks in "
Tasks List".
Set Window Layout
You can set the windows environment that you want to set for yourself. You can save that layout and that layout will be open whenever you start working.
Simply open the window that you want to open initially like I have opened "Toolbox" on the left side. At the right side I have set "Solution Explorer" window and at the middle i have set the coding window. After setting window click on Window tab in the menu and the "Save Window Layout". Shortcut for Save Window Layout (Ctrl+Alt+1).
Now after saving the window layout this will be default layout for your visual studio.
#Region
#Region is used in the code to specify your code in blocks.
Let's suppose I want to make block of class separate and methods block separate.
#region is the starting syntax and #endregion is the ending syntax. With the starting syntax you can specify the name of particular region. In the snippet i have 2 regions one with the name "Class" and other with the name "mymethods".
The advantage of using #region is that you can expand or collapse that particular region when there will be hundreds of methods and classes. #region will be useful for specifying your code into different blocks.
Toggle Your Code
You can expand or collapse your desired selected lines with the shortcut keys.
=> Ctrl+M+H, Ctrl+M+U
Select some line of code and then try these shortcuts.
Shifting the Tabs
You can open the desired tab in your visual studio following these shortcuts. This shortcut will be helpful when there are different tabs open in the visual studio.
=> Ctrl++, Ctrl+-
The Bulb
The bulb helps you to define the expected methods for your variable. e.g, select the line from code & then press Ctrl+. this will give you some hints that you may be interested to define for your code.
Select "private int name" then press Ctrl+. This is asking me to generate constructor or encapsulation. When you hit enter on constructor or encapsulation this will add the functionality of constructor or encapsulation.
Increase or decrease font size
You can increase or decrease the size of your code as:
=> Ctrl+Shift+. , Ctrl+Shift+,
Move Line
You can move the selected line or where cursor blinking you can move that line to downward direction or upward direction.
Try this shortcut to move the line upward or downward.
=> Ctrl+ Line
Line means upward or downward arrow on your keyboard.
Navigate To
You can navigate to any other page that you want to open in Visual Studio.
Ctrl+,
Reuse your Code
You can reuse the code without having to type over and over again:
- Place it in a toolbox under one of the sections or create your own one.
- Drag and drop as required.
Once your code is added to toolbox then you can use that code to any every project, simply drag and drop that code from toolbox in the desired code where you want to add.
You can also rename that code in the toolbox.
IntelliSense
While typing words in visual studio code you can auto complete the word using IntelliSense. While writing just enter:
=> Ctrl+Space
Quick Launch
Quick launch is the most beautiful feature of visual studio that let you add the functionality that you don't remember. For example, you don't remember where that feature is present in Visual Studio.
- Simply press (Ctrl+Q) and then type the desired feature name or just hint about that feature. Syntax for using Quick launch is:
=>In the search bar type "@opt desired_feature_name".
E.g:
Formatting
Using this shortcut the visual studio coding format will be according to the preferred visual studio format.
=> Ctrl+K, D
Propfull
Use this keyword while typing access specifier in your code. Access specifiers are public, private and protected keywords. Using of propfull will create access specifiers and getter setter for us automatically.
=> Type Propfull+tab+tab
Vertically Selection
Select the text vertically, just press Alt and select the code.
These are some important features and shortcuts for Visual Studio during development that are most important to make your whole life easier. For more features or shortcuts you may simply comment on the article and I will catch you all.