Fifteen Visual Studio skills to improve your development efficiency

Source: Internet
Author: User

I believe that developers do not pay less attention to efficiency. C # and VB developers all know that we rely heavily on VS, or we are very grateful to. The ability to create dependencies on an IDE indicates that this IDE does have its uniqueness. Undoubtedly, VS is a very powerful IDE that supports multi-language editing. Supports C #, VB, C/C ++, HTML... it has powerful debugging and compilation capabilities. It eliminates the need to remember the cumbersome processes of installation, environment variable settings, server settings, and compilation. Highly integrated. There are advantages and disadvantages in everything. In the era of agile development, there is no doubt whether VS is worth our use. However, powerful VS has many settings and many skills. Remember some tips that make it easier and quick to use. This is necessary. Everyone remembers some tips. But it is impossible to remember all of them. We should remember some of the things we commonly use according to our own programming habits.

The following are some tips that you may find frequently used during the coding process and hope to help you.

 

1. Edit rows (copy, cut, delete, switch)

 

When you press Ctrl + C, X, L on the cursor, you can copy, cut, and delete the entire line of content. Of course, right-click is also acceptable. Compared with the normal copy, cut, and delete operations, this is only the difference between the selected code and the unselected code.

If you want to switch the upper and lower lines, you can use the shortcut key (Shift + Alt + T), provided that the cursor stays on the top line. After replacement, the cursor will always follow the original line.

 

2. Note (// TODO :...)

 

If you look at the title, you may want to hit me. The programmer does not know the annotations. He does not know either // or/* ...... */or (HTML/XML annotation ). However

// TODO: Comments

Probably a minority. If you like to use the "task list" to record some things to do, this small function is best for you. In the VS 2010 menu, you can find the task list window and click "menu> View> Task List". You can also click the shortcut key "Ctrl + W, T ". VS also provides, HACK, UNTODU, UnresolvedMergeConflict tag annotation. You can find and edit/Add/delete tag annotations in "Tools> Options> environment> task list. The figure below shows:

 

3. Create a region (# region and # endregion)

 

As code grows, you expect to hide some code, and # region and # endregion are like this. You can hide any code anywhere. Even hidden content does not belong to the same function. You can click +/-next to # region to expand/hide the code. When your cursor is placed on the remarks, VS will display the hidden code content.


4. Select a word/a string

 

As you know, double-click a word to select the entire word. Press Ctrl to select a word at any position.

Double-click the left side of the first quotation mark of the string to select the entire string. Press Ctrl and click the front of the first quotation mark to select the entire string.

 

5. Put the code in the toolbox

 

The toolbox is used to place controls. When using the control, we only need to drag the control from the control to the code, which can save a lot of code editing work. Since the toolbox is so convenient, can you put a piece of code with high reusability into the toolbox. Of course the answer is yes.

You can select your code and drag it into the blank area of the toolbox. Your code is saved to the toolbox. Just as you drag a widget into the code page, you can also drag the code into the toolbox. In the future, you can use reusable code just like using controls. This is very convenient. In addition, the toolbox content will not disappear because you close VS. The Toolbox also saves your code when you open VS next time. If you need to view the code saved in the toolbox and do not want to drag it to the code page, you just need to move the cursor over the code icon in the toolbox. As shown in the figure:

 

6. format the code

 

This is very important, even though VS will automatically format the code after you press ";" each time. But it is inevitable that the code format will change. For example, after a piece of code is pasted, the code format is often affected. Therefore, it is necessary to know.

Format part of the Code: select the code-> Ctrl + K, F. Or Ctrl + E, F.

Format the entire document: Edit> advanced> set the document format. Or Ctrl + K, D. Or Ctrl + E, D.

 

7. switch design/code Diagram

 

Switch to ASP. NET (HTML): Ctrl + PgUp/Ctrl + PgDn

Switch the windows form: F7/Shift + F7 (code/design)

 

8. Find the error code.

 

When an error or warning prompt is displayed in the error list, you can double-click the error or prompt to jump to the statement of the error or warning.

 

9. Jump to the specified row number

 

This is useful when there are many codes. In ASP. NET programming, many errors can only be found when running the website, and this error is not prompted in the error list, you can use this tips to jump to the wrong code.

Double-click the row number in the lower right corner of the status bar to jump out of a line number jump form. Or press Ctrl + GTO open the form. You can also click Edit> jump to... in the menu bar to use this function.

 

10. Quick Search

 

The cursor stays above the word to be searched. Use the shortcut key Ctrl + F3 to jump to the next same word. Press Shift + F3 to search up.

 

11. Find "{/}"

 

Search: Are you worried? Some of the corresponding tags cannot find the end, and the end is unknown. When you place the cursor in front of "{", VS will mark the corresponding. You can also move the cursor behind "}" to achieve the same effect.

 

12. search and replace

 

When you want to find/replace a string, you can press the shortcut key "Ctrl + F" or "Ctrl + H" to perform this operation. In addition, VS supports regular expressions and wildcards.

If you want to find/Replace the entire project, you need to use the shortcut key "Ctrl + Shift + F" or "Ctrl + Shift + H ". Of course, all of this can be found in the menu bar. "Edit-> search and replace ". When you want to abort global replacement, you can use the shortcut key "Ctrl + Pause Break ".

 

13. bookmarks

 

Bookmarks are very useful. Anyone who has used Chrome knows that. Bookmarks also apply to. It can help you save the location so that you can write code.

Place bookmarks: Ctrl + B, T.

The last bookmarks: Ctrl + B, P.

Next bookmarks: Ctrl + B, N.

Delete all bookmarks: Ctrl + K, C.

In addition, VS also provides other bookmarks.

 

14. Jump to definition

 

When you view the code, you often need to view the original function, which is inevitable. But do not look for functions manually. This efficiency is often very low. You can right-click the function and select jump to definition. You can also use the shortcut key F12.

 

15. Insert external text as text

 

"Menu-> edit-> insert a file as text"

The advantage is that you do not need to open the file to copy and paste it.

 

Maybe you already know these tips. Or, you think these skills are useless. Of course, our most important task is coding. There is no need to spend your thoughts on this. However, when you are used to using these tips, the benefits you bring will not disappoint you. I think it is necessary to master some skills.

In short, let's let others go.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.