Developer Productivity By Visual Studio Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using mouse again and again while programming with Visual Studio IDE. There are some very useful hot keys which can increase our productivity significantly.

So, I decided to share a list of visual studio keyboard shortcuts that are amazing and very helpful.

  1. While code review I found scattered and unaligned code many time which we all hate. I used CTRL+K+D for aligning it. The left side of my code is scattered, so first I selected the area of code and then applied CTRL+K+D.

    code review

  2. Use F12 to go to definition of class. Use CTRL- to go back.
  3. Resolve the classes and use CTRL+.
  4. Refactoring is very important. Use CTRL+R+M for extracting a method.
  5. Want to put few lines of code in try block. Try Ctrl + K + S.

     put few lines of code in try block

    It provides a lot of options.

  6. Ever tried selecting a rectangle code. Use ALT click drag.
  7. Lots of code in a single file. Use CTRL + M + O and CTRL + M + X in collapse/expand code groups like regions, methods.
  8. Lots of code and there are no groups. Use CTRL+M+H/CTRL+M+U.
  9. Create new Class using CLS and press TAB twice, or
  10. Create constructor using CTOR and press TAB twice.
  11. Create properties using PROP and press TAB twice.
    Create a properties use PROP press

  12. Create for loop using CTRL+K+S, then go to foreach and press Enter or TAB.

    Create a properties use PROP

  13. Write full property definition that we used in earlier to C# 3.0, then use propfull, press TAB twice.

    Create a properties

  14. Create switch block, use switch, press TAB twice

    switch
  15. Write our own custom exception class that should inherit from Exception class.

    Exception press TAB twice.

  16. Write console.writeline, use cw, press TAB twice.
  17. Show the horizantal space by dot  use  CTRL+R, CTRL+W
  18.  Remove the Horizontal space , CTRL+ K  ,CTRL+ \
  19.  Shifting the code  left side  use Shift +Tab
  20. Shifting  code right side use  , select the code and use Tab

This is not the complete list but very common ones that can be used a lot in our day to day coding.

I hope you liked this. Have a good day. Thank you for reading.

Up Next
    Ebook Download
    View all
    Learn
    View all