They are just little tricks. Over and over, they make our work, learning more efficient, and let us focus more on the logic itself, they are. NET Programmer's good friends, they are the little tricks of Visual Studio ... Do we really know them?
If you want to master these skills as quickly as possible, open Visual Studio and try these tips yourself to find the skills you like.
(Image from Bing)
Get the code to write faster
How to create a class quickly? Create an application, find a space to build, and try this:class<tab><tab>.
Don't worry, this technique is not finished yet. Enter the desired class name directly, and then hit enter.
Create attributes often? Try prop<tab><tab>.
Write a foreach statement often? Try foreach<tab><tab> .
Write console applications often? Try cw<tab><tab> .
What if I have more than one highlighted area? Use tab to jump.
How to find other code Snippets? Try using the context menu or shortcut key.
Let the namespace operate a little faster
Often write file-related operations but the tragic discovery System.IO is not in the default reference namespace? Oh, try this. Enter file+<esc>+ctrl+.+<enter>directly in the method.
Well, this combination looks a little complicated. Let's see the decomposition action, once it becomes a muscle memory, everything will become so natural
First,File + <ESC>, the input class name file,<esc> is used to eliminate completion List. At this point, you can see that the lower left corner of the file has a small blue block, this small piece indicates that the smart tag has been available;
Then,Ctrl +. Used to open SmartTag, typically, adding a using will be the first option.
Finally,<Enter> applies the first item.
Exception: This technique does not apply to extension methods.
Make namespaces lean and orderly
Well, if you want your class to finish, let the number of references be minimized and sorted alphabetically, you can use this combination:<Application>+<o>+<a>.
Don't know which key is the <Application> key? I don't know, I'll borrow a name from here. In fact, the right CTRL key to the left, to bring up the context menu key.
Let's inherit the abstract class and implement the interface a little faster
When there is an abstract class on the hand, there are n abstract methods, and when the abstract class is inherited, it is laborious and tedious to rewrite the name of the method--like copying the method name. Why not let Visual Studio do it?
To make it easier for you to do this, copy and paste the following code into Visual Studio:
Person
{
void Walk ();
void Eat ();
}
Person
{
}
Then put the cursor on the person behind baby and see SmartTag? Then let's ctrl+.+<enter> .
This method also applies to interfaces.
Let's rename it a little faster.
Often in order to lazy to take a shorter variable name? Some team will not allow the use of abbreviations as variable names, and the full name is too long, at this time, you can write a short name, and then renamed directly. For example, some teams do not allow single-letter variables, like the I:
for (int i = 0; i <; i++)
{
System.Console.WriteLine (i + 1);
}
First, generate a for statement through for<tab><tab> , and then use cw<tab><tab> to generate the WriteLine statement.
Then, position the cursor behind the first I and enter Ndex.
See the tip of SmartTag? ctrl+.+<enter>
Written in the last
In addition to sorting the reference namespace reference, in fact, we only have access to two shortcut keys:
<tab><tab>
CTRL +.
The former is used primarily to insert code snippets, which is used to call SmartTag.
These are not advanced techniques, but they are the techniques that are used every day when writing code. With these little tricks of the accumulation, I believe it will stones.
These techniques do not help you to write better code, but, after getting used to it, it can improve the speed at which we write code, which in turn allows us to spend more time improving the quality of our code.
Let's get a little faster. Visual Studio Tips