One: What is Reshaper?
Even those who attack. NET and C # all day long have to admit that Visual Studio is really a powerful IDE, unless he thinks fewer IDE features and command-line debugging are more powerful. However, even so, some third-party individuals and vendors have been prevented from developing plugins to make VS stronger. Reshaper is a vs plug-in that provides some features that are easier for programmers to use with VS, and, of course, the disadvantage is that it consumes more memory and is likely to slow down your less powerful development machine.
After installation, there is a reshaper in the VS Menu.
Two: Set
1.1 Smart Tips
After the installation is complete, the IDE's Smart Tip (IntelliSense) will use the Resharper hint by default, and I don't know why, I've never liked the hint. Change it, in the option window:
1.2 shortcut keys
It is strongly recommended that you use Reshaper shortcut keys, do not worry about Reshaper will put your original shortcut key set to overwrite, because if a shortcut key and VS is conflict, Reshaper will let you choose to use VS or Resharper shortcut keys, see the following interface:
Note, do not choose Apply to all Reshaper shortcuts, if you choose, this interface will no longer appear, and generally, you will prefer to make your own decision in the conflict.
Of course, if you must use the VS original shortcut key, then you should select the option in the window below the red box, then shake the hand, point to Save:
1.3 Integration with StyleCop
If we install StyleCop (http://stylecop.codeplex.com/) at the same time, Resharper will integrate to indicate whether your current code conforms to your STYLECOP settings.
PS: The following configurations are based on STYLECOP 4.7 and Reshaper 7.1.3. In some cases, the older version of the STYLECOP and reshaper are not integrated so that you cannot use the Resharper hint on the path of the code specification.
After integration, we can Add a new rule in the Code Eidting-〉code Cleanup interface of the option interface, and then, in the new rule, you can see the STYLECOP option, as follows:
After these settings, the IDE will be prompted according to the criteria of this setting, as follows:
1.4 reshaper stylecop Set rule and StyleCop itself set rule conflict problem
StyleCop familiar with the code of Friends are aware that if your project set the STYLECOP itself rules, STYLECOP will generate a setup document, as follows:
So, can Reshaper's StyleCop set rules and StyleCop's own set rules become one? The answer is: I'm sorry, no! You have to set it at both ends to make it consistent. so to me, reshaper that hint or codeclean is just an auxiliary means, stylecop that "Run StyleCop" is the final submission criteria.
1.5 What should I do if I don't like a hint?
Yes, you can modify the settings. As follows:
In this case, I don't like to hint at the variable starting with the underscore as warning, we can choose the bottom change settings ... To make changes, select the following:
As you can see, we modify the prefix to add.
Three: Universal Alt + Enter
If we use the Reshaper shortcut setting, then, at each prompt, click ALT + Enter key combination, will pop up Resharper suggest you want to do, such as:
In this tip, Reshaper tells us that there is no reference to the System.Text namespace, and this time, clicking Alt + Enter will automatically use the namespace;
3.1 Auto-complete syntax sugar
Another example:
Alt+enter the key combination on StringBuilder, you will be prompted to use Var here.
Or, for example, if you use a combination key on if, you will be prompted with the ternary operator:
In short, Alt + Enter is omnipotent, see the hint, use it, you will often get meaningful help to improve the quality of your code. Some of the complex LINQ you won't write, using Alt+enter will automatically help you convert some of the code into a very forked LINQ, as if you were a LINQ master;
3.2 Hints
This little light is a hint, if you do not want to use ALT + Enter, you can use the mouse to poke here, there will be Resharper suggestions.
Four: Find Usage
In a class, or in a variable, or on a method, the Find Usage, or the stamp shortcut ALT + F7, is the place where all of your selected classes or variables or methods are referenced. In other words, the search and look-up references after VS2012 are simply too weak to explode. In short, this feature is also a highlight of reshaper.
In particular, we note that in the picture, it will be you many times to find the form of a tab to keep you, we are in the analysis of the code, often a one-time lookup of multiple variables of the reference, at this time, it is particularly helpful. In short, this feature is necessary and very programmer.
V: File Structure
Also, is it annoying to look at the structure of the class to poke this drop-down box:
At this time, you press the key combination CTRL + F11, the Resharper File Structure window appears:
It is convenient for you to see your entire member variable window.
6:0-like reconstruction
A programmer who always writes the perfect code is always in the mind of an idiot leader, as we all know that code is reconstructed and never designed. So, you'll always need Ctrl + Shift + R:
Resharper Lists the refactoring methods you might use, either by moving the keyboard or the mouse, and you're ready to reconstruct it instantly.
Seven: Quick completion of code
With the IntelliSense and tab keys provided by VS, the ability to quickly complete code, such as entering code prop, and then pressing the TAB key, automatically creates a property, but Resharper provides additional options that look like more code to complete.
Press the key combination Alt + Insert, the following window appears:
I've never used the VS method to automate the creation of a constructor, and it's easy to do this with Resharper.
Eight: Cleanup Code
After writing a wo consulted class, what is the most enjoyable, is to let it in the way and change the specification, this time, we need to right-click Cleanup Code (Ctrl + Alt + F):
Resharper provides a choice for us to set Cleanup code specification, of course, because we have introduced the STYLECOP, so this specification can be set up very convenient.
PS: The above belongs to the development of commonly used reshaper function, this article is used for training members to use Reshaper, focusing on the issue of the shortcut key conflict and STYLECOP combination with the problem.
Use of ReSharper