You are here
Home > Programming > Writing Faster Code With Visual Studio 2013

Writing Faster Code With Visual Studio 2013

Writing Faster Code – I’m sure that many of you already know the following tips. Some of these are probably not even confined to Visual Studio 2013. Nevertheless, I called the article ‘Writing Faster Code With Visual Studio 2013’ because that is the version of the Visual Studio IDE I use. I feel however that this is a nice article to include on my blog, as it will make many of us more productive.

Writing Faster Code

So what are these tips? They are really simple. How many characters does it take to get to the ‘WriteLine’ method of the Console class? If you’re doing this often, you will no doubt be using copy and paste.

Writing Faster Code

Here is an easier method. Instead of writing out the code fully (letting intellisense filter it as you type), use Pascal Case instead. Intellisense automatically recognizes this and filters the results accordingly. (By the way, this is PascalCase while this is camelCase.)

Writing Faster Code

The same trick can be use to write something like StringBuilder.

Writing Faster Code

When writing code and you want to create methods, you can simply use the Ctrl+K+M shortcut. You will see that I have added a call to a non-existent method called ‘GetHashedData’. Visual Studio 2013 quite rightly underlines the error.

Writing Faster Code

Highlight the underlined GetHashedData method call and press Ctrl+K+M. Visual Studio 2013 reciprocates immediately.

Writing Faster Code

When you want to navigate to the definition of a method or variable, put your cursor on the method or variable and press F12 on the keyboard. You will be taken to the referenced method or variable in the wink of an eye.

Writing Faster Code

If you just want to take a peek at the method instead of actually navigating to the method itself, you can use Peek Definition. To do this, press Alt+F12. To close the preview press Esc.

Writing Faster Code

Quickly surround your code by pressing Ctrl+K+S. I find this useful for surrounding my code with regions.

Writing Faster Code

Sometimes having to sift through multiple lines of code and to navigate up and down the code file, can become tedious. Quickly collapse highlighted sections of code by pressing Ctrl+M+H. To expand the collapsed region again, press Ctrl_M+U or just click on the + in the editor.

Writing Faster Code

These are but a few shortcuts and tricks I use to make my coding faster. There are numerous other shortcuts out there. Throw in a few 3rd party extensions (Think PowerTools) and you can really fly through mundane, repetitive coding tasks in no time. If you have a tip to share, do so in the comments!

img ref

Dirk Strauss
Dirk is a Software Developer and Microsoft MVP from South Africa. He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix. Apart from writing code, he also enjoys writing human readable articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has yet to master.

Similar Articles

Top