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.