This is in continuation with article 1 where I discussed about how one can be more productive with Visual Studio. In article 1, we discussed some shortcuts that helps a lot while writing and reviewing code in day to day work. While writing code we need to follow certain rules and constructs that also becomes very repetitive. For example, you are writing classes for your domain or adding properties or defining constructors or putting try block and lot more where we just need to write the code in similar pattern. Spending time in these types of codes are waste of time and energy. To see my previous article 1, here's the link:
In this article, I am going to discuss some more tricks that can insert code snippets just by few keystrokes.
- For creating an MVC [HttpGet] action method use mvc4 and press TAB twice.
- For creating MVC [HttpPost] action method, use mvcp and press TAB twice.
- For creating unit test class in MVC application, use test and press TAB twice.
- For creating Unit test method, use testm and press TAB twice.
- For creating a region, use reg and press TAB twice.
- For creating static int Main (string[] args), use sim and press TAB twice.
- Create auto implemented properties with 'get' accessor and private 'set' accessor using propg and press TAB twice.
- For creating void main method use svm and press TAB twice.
- Create try finally block using tryf and press TAB twice.
- Create MessageBox.show(“”) using mbox andpress TAB twice.
- Create Interface using int and press TAB twice.
- Create foreach() loop using fore and press TAB twice.
- Create do while loop using do and press TAB twice.
- Create for loop using for and press TAB twice.
- Create while loop using wh and press TAB twice.
Some other tips and tricks:
- Open Package Manager Console using ALT + T + N and press Enter key.
- Build the project using CTRL + SHIFT + B.
- Open Solution Explorer using CTRL + ALT + L.
- Open Server Explorer using CTRL + ALT + S.
- Find the location of project, right click on project and go to open folder in file explorer, then press enter or click.
- Start Visual Studio from “Run” command prompt using devenv, then click ok.