Shortcuts in Visual Studio

As i have self professed earlier, i am a rather lazy coder.So i thought if i had a few newbie Dotnet brethren down there somewhere,who might find the following interesting.(Pros this is just a cakewalk for you!)I am just jotting down some of my favorite Dotnet shortcuts,though there are a few exhaustive hundreds of them.Here are some of them.

Ctrl + “.” ——–Adds the references, ie it opens the tag window and we can just hit Enter when it pops up.

image

Ctrl+K+C and Ctrl+K+U ——Comments and Uncomments code

Ctrl + ”-” and Ctrl +Shift + “-”————Used for navigating backward and forwards

Ctrl +X or Ctrl + L ————No need to select the entire line and do a shift+home or shift +end,stay anywhere on the line and just do it.It cuts the entire line.Similarly for Ctrl + C.

F7 ————-Changes from Design view to Code view or vice versa

F12 ———Go to definition

Shift + F12—— Find all references

Ctrl +M+L and Ctrl + M + O ——– Collapse and expand definitions.

Ctrl +Shift +V ——- To rotate the pasted items in the clipboard.ie you can get prevously copied snippets!only 20 at a time.

Ctrl + U and Ctrl +Shift +U—— to make the variables lowercase or uppercase.

Ctrl + R + E ——- if you have missed writing a property with prop + tab + tab,dont worry,first click on that line and type this shortcut which basically opens the encapsulate method smart window.

Alt + Ctrl + P —– Opens the Attach Process Window

Ctrl + D + P ——- View all the attached processes.You can individually detach each process here.Pretty useful especially if you want to detach one and add another

image

Alt + Ctrl + Q or Context  + Q——opens QuickWatch

Ctrl + K + D ———–Formats(sets proper indentation) the entire code in the current file .Or else just got to the last curly braces and just remove it and add it again.Voila its done!

Ctrl +Shift+F10 —– set the execution point to the current line

Ctrl +Shift+F9 —– removes all breakpoints

Alt + Ctrl + I —– command window

In addition to the hundreds of shortcuts that you have,we can create more by going to Tools->Options->Environment->Keyboard and then specify the shortcut that you want.My Fav one, is the one that we are all used to doing with the mouse..File.OpenContainingFolder(i just assigned the Alt+O)

image

Trivia..try running this from Run/Command Prompt..(try this at ur own risks).Later you can go to the prompt and try out other switches like ”devenv /nospash”.

“devenv.exe /resetuserdata”.(the switch kinda gives away the clue!)

For the exhaustive set of C# shortcuts download the pdf from the following location.

http://www.microsoft.com/downloads/details.aspx?FamilyID=92CED922-D505-457A-8C9C-84036160639F&displaylang=en