It takes thousands of miles. Small streams are built into rivers and seas.
They are just inconspicuous tips. Over time, they make our work and learning more efficient, and let us focus more on the logic itself, they are. netProgramThey are good friends of Visual Studio ...... Do we really know them?
If you want to learn these skills as soon as possible, open Visual Studio and try these skills yourself.
(Image from Bing)
Let Code Write faster
How to quickly create a class? Create an application and find an empty space that can be used to create a class. Try this:Class <tab>.
Don't worry. This skill is not complete yet. Enter the expected class name and press Enter.
Frequently create attributes? TryProp <tab>.
Often write foreach statements? TryForeach <tab>
Frequently write console applications? TryCW <tab>
What if there are multiple highlight areas? Use tab to jump.
How to find other code snippets? Try the context menu or shortcut key.
Faster namespace operations
I often write file-related operations, but the tragedy found that system. Io is not in the default reference namespace? Haha, try this. EnterFile + <ESC> + Ctrl +. + <enter>.
Okay, this combination looks a little complicated. Let's look at the decomposition action. Once it becomes a muscle memory, everything will become so natural.
First,File + <ESC>, Input class name file, <ESC> is used to eliminate the Completion list. At this time, we can see that there is a small blue small block in the lower left corner of the file. This small block indicates that a smart tag is available;
Then,CTRL +.Used to open smarttag. Generally, adding using is the first option.
Finally,<Enter>The first item of the application.
Exception: this technique is not applicable to extension methods.
Streamline and orderly namespaces
Well, if you want to minimize the number of referenced names and sort them alphabetically after writing your class, you can use the following combination:<Application> + <o> + <A>.
Don't know<Application>Which key is it? I don't know. I 'd like to borrow a name from here. The one on the left of the right ctrl key is used to call up the context menu key.
Make inheriting abstract classes and implementing interfaces faster
There is an abstract class with N abstract methods. When the abstract class is inherited, rewriting these method names is time-consuming, laborious, and boring-like copying method names. Why not let Visual Studio do it?
Copy and paste the following code to Visual Studio for your convenience:
Public Abstract ClassPerson
{
Public Abstract VoidWalk ();
Public Abstract VoidEat ();
}
ClassBaby: person
{
}
Then place the cursor on the person behind the baby and see the smarttag? ThenCTRL +. + <enter>Right.
This method also applies to interfaces.
Make renaming faster
Is a short variable name often used for laziness? Some teams do not allow short names as variable names, but the full names are too long. In this case, you can write short names and rename them directly. For example, some teams do not allow single-letter variables, such as I:
For(IntI = 0; I <100; I ++)
{
System. Console. writeline (I + 1 );
}
First, useFor <tab>Generate the for statement, and then useCW <tab>To generate the writeline statement.
Then, move the cursor behind the first I and enter ndex.
What are the small parts of the smarttag prompt?CTRL +. + <enter>
Conclusion
In addition to referencing the namespace for sorting, we only have access to two shortcut keys:
<Tab>
CTRL +.
The former is mainly used to insert code snippets, and the latter is used to call smarttag.
These are not advanced technologies, but they are the skills used every day when writing code. With these tips, I believe they will be worn by water.
These skills cannot help you write better Code. However, after you get used to it, it can speed up code writing, this gives us more time to improve code quality.