Some unknown Visual Studio coding skills in C #

Source: Internet
Author: User

After years of using Visual Studio, I found this coding technique today. I am so ashamed to share it with you!

Development Environment: vs2010 + C #

1. Code refactoring New Class

If you still use the shortcut menu to create a class as before, it would be too Out. The "New Item dialog box" in VS is very slow and affects your mood.
When you find that you need to define a class, the correct method is as follows:
1) define the class name in the current Code, for example, List <NewClass> ls;
2) Move the focus to NewClass and press ctrl +. ("point ")
3) Press enter.
This class is created. This method also applies to class methods, attributes, fields, renaming field method names, etc.

2. Extraction Method

Sometimes we find that we are always writing the same piece of code. We can extract a method. How can this problem be solved? Work with me
1) select our code without the mouse
2) press ctrl + r and m (note that this is done twice)
3) In the displayed dialog box, enter the method name and press Enter.

3. Insert a quick phrase

Quickly define dependency attributes
1) Input propd
2) press the Tab key twice quickly.
3) enter in the selected area, press Tab to switch to the next area, and press Enter.
In fact, just now we inserted a quick code phrase snippet, which vs can define by itself, through the "tool" menu => code segment manager.

4. Other shortcut keys

Quick Switch tab: ctrl + tab
Jump to the start or end position of a word: ctrl + left and right arrows
Full Screen Editing code: shift + alt + enter
Call up the instant window: ctrl + alt + I

There are more shortcut keys to reduce the switch between the mouse and keyboard, effectively saving the coding time.

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.