5 Shortcuts in Visual Studio to Skyrocket Your Development Process
Shortcut keys in visual studio
Before I begin, I'd like to mention that I use these shortcuts within Visual Studio. Not Visual Studio Code or any other IDEs out there. I have noticed that some of the shortcuts work in other environments, nonetheless, I am writing this article with the mindset that you will use these shortcuts in Visual Studio.
Now, let's get into it.
For my people out there who don't like to read so much, here are the shortcuts:
- Ctrl + Shift + B - Build Your Solution
- Ctrl + Shift + F10 - Skip To The Selected Line
- Ctrl + K + C - Comment a Section of Code
- Ctrl + K + U - Uncomment a Section of Code
- Ctrl + K + D - Auto Adjust Lines
Now, for the people who love me and like to read my articles😏, here's a deeper insight into these shortcuts🤭
Haha...but all jokes aside, if you'd like to see use case scenarios and a bit more explanation on these shortcuts, continue reading.
Let's Go
Build Your Solution
As shown above, to simply build your solution within Visual Studio, you can type Ctrl + Shift + B.
You no longer have to click Debug, then select Build to build your application. You can simply type Ctrl + Shift + B.
Take a look at how it is used below:
Skip To The Selected Line
It has been a while since I started developing backend solutions - give or take 10 months😅. Be that as it may, I have come to understand that there will be times when you need to test a particular function in your application, but do not need to run the entire process. That is where this shortcut comes in handy.
In situations like this, I would simply right-click and select set next statement. However, I find this process a little too slow for me when I am in the zone and don't want to break my flow😎.
So, instead, I now type Ctrl + Shift + F10. It's easy, and frankly, fast enough for me as compared to its right-click counterpart.
Check out a use case scenario below:
Comment A Section Of Code
All the shortcuts mentioned so far have been tremendously helpful to me when developing. Nonetheless, out of all the shortcuts I use today, none has been as refreshing and fun to use as the Ctrl + K + C.
Words alone cannot express my experience with this shortcut.
When I am in the mood and want to quickly add a comment to remind myself about an idea, Ctrl + K + C.
When I am debugging and find a section of code I don't need to show, Ctrl + K + C
When I am looking through a clone of a senior's code, trying to understand what each section means and does, Ctrl + K + C is ever ready to assist with my notes.
A little side note. Please, always clone any developer's code before adding comments to the whole thing. You can incur the wrath of some senior developers if you don't😅
This shortcut can be used for almost anything you think of. Rather than typing // to comment lines of code at a time, simply type Ctrl + K + C anywhere on the single line of code or select the lines of code to comment out before typing Ctrl + K + C.
Have a look at the video illustration attached below:
Uncomment A Section Of Code
Just like in Black Clover, for every magical occurrence, there exists a possible anti-magical...see, I don't know how to type what I'm thinking here.
For those that watch Black Clover, I was trying to say there's an Asta for all magic, and that this shortcut is the opposite of the previous shortcut.
For those that don't watch Black Clover, forget all I just said, and let's move on😅
Simply put, our last shortcut comments lines of code while this shortcut uncomments. This is very useful when developing. You could use it to uncomment the lines of code you commented out while debugging or to re-insert a section of code you need for production.
Honestly, you can use this shortcut however you like.
Just be mindful not to uncomment something you want to get rid of. In fact, in such cases, you are better off deleting that section of code. Just make sure it's a line you know you will not use.
As usual, I have attached a video illustration to supplement my explanation.
Automatically Adjust Lines Of Code
Writing about this shortcut last is not to lessen the usefulness of this shortcut. I've even found that I use this shortcut far more times while developing than some of the other shortcuts listed above.
In trying to come up with solutions to everyday problems, I consult stack overflow, and in certain situations, I actually copy the content from the community.
However, as you might have observed, sometimes, when you paste the content you copy, it skews your arrangement. That's where this big guy comes in.
Rather than placing your cursor just before the line of code and tapping the Tab bar multiply times or the delete button to reduce indentations, simply press Ctrl + K + D, and voila, your entire line of code is organized.
I'd like to state, however, that you need to ensure your lines of code are properly closed, or else, you might run into errors.
Take a look at a use case scenario below:
Finally
With that being said, I hope you start to use these shortcuts. They have helped me many times, and I am more than confident that they will be quite useful to you too.
So, until next time, keep going after the life you want without compromising on your values.
✌🏼