Search This Blog

Thursday, February 12, 2015

Visual Studio Tips and Tricks

Visual Studio Tips and Tricks

Selecting an updating code vertically

Hold down SHIFT + ALT while you’re selecting a code snippet. Now if you move the arrow keys , you can select vertically
Now you can update the code simultaneously too , if you type all vertically selected code line will be updated.

 

Navigating between open files

Press CTRL + TAB or CTRL + SHIFT + TAB to open this overview window. You can then move around using the TAB key or the arrows.

Cut the whole line

If you mark a text and press CTRL + X that text will be cut. But if you don’t mark any text and press the same CTRL + X the whole line (including carriage return) will be cut. You can also press CTRL + L to cut the whole line without the carriage return.

Select active document in Solution explorer

If you are having a lot of files and folders in your project you may face problem to get the active document. Here’s the solution:
Press the Left Right arrow button in solution explorer to navigate to current document.


Inserting snippet (way of saving a lot typing)

Using snippets you can save a lot for your typing.
To insert snippet navigate to where you want to add and press Ctrl + K and Ctrl + X to open snippet windows (Or right click and choose insert snippet) . Use up down navigation keys to move through list or press any character to navigate to particular item.
Press enter to insert snippet. Use the tab key to move between fields in the code.



 

Wrapping a code block inside other predefined code blocks

Just select the code block which you want to wrap inside other code blocks and Press Ctrl + K and Ctrl + S to open code blocks list (or right click and select Surround with).
Select from the list in which code block you want to wrap your existing code and press Enter.

Implementing interface

Put the cursor to the interface which you want to implement and press Ctrl +. (Period) and select implement interface from list (or right click and select implement interface from menu) , all the functions of that interface that needs to be implemented will be populated automatically.


No comments:

Post a Comment