The omnipotent Alt + enter can help you write a lot Code The dirty work in the process is summarized as follows:
- Helps you implement an interface or abstract methods of the base class;
- Provides suggestions for handling the current warning;
- Provide you with some suggestions for handling current errors (not necessarily true errors );
- Simplify the current bloated code for you;
Helps you implement an interface or abstract methods of the base class
This function is also provided by Visual Studio. Every time you add isomeinterface to the class name, it will prompt you to press the tab key to generate the stubs of all methods in the interface. If you do not press the button at this time, you can hover your mouse over the interface name, and a small one will appear, and generate a method. After resharper is installed, this function is considered as the same solution as other warnings. If you: After isomeinterface, there is no way to implement it, this line of code will be tagged with a Tilde, indicating a warning or error occurs. Press Alt + enter to generate these methods for you.
Don't let me make a fuss. After you modify the isomeinterface interface, for example, adding an initial method, the fastest way is: on isomeinterface, click Ctrl + Shift + G to browse the implementation class of this interface, and then Alt + enter. The initial method is immediately added to this class and code can be written.
Provide some suggestions for you to handle the current warning
some details that you may ignore sometimes are not ignored by resharper. For example, if you use implicit type conversion:
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> button BTN = sender as button; // implicit type conversion
instead of checking whether it is empty, use it directly. At this time, resharper will prompt you a warning. If you press Alt + enter, it will include your subsequent code in an if statement:
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> If (BTN ! = null )
{< br> // your next Code
}
But what I'm not satisfied with is that what I often want is this effect: If(BTN= Null)
Return;
I don't know if this behavior can be modified in the configuration.
Some suggestions for handling the current error
Marked red by resharper indicates an error, and sometimes an error may be caused by your intention. For example, you wrote the following in view. CS: _ Presenter. getalllayers ();
In fact, your presenter. this method is not available in CS, so pressing Alt + enter will immediately be in presenter. add this method to CS and jump to this method. If the presenter is not distributed in more than one file, a dialog box is displayed for you to select. Compared to Visual Studio's frequently bloated dialog box, resharper's pop-up dialog box is often very direct, you only need to select what you need immediately with the direction key and press Enter.
Simplify your current bloated code
if your code is considered redundant by resharper, it will be identified in gray, for example:
code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/
--> This . text = " title bar text " // This is gray
btnok. click += New eventhandler (btnok_click) // New eventhandler is gray
redundant code is harmless, but it is not so concise. If you open the code you have written before after installing Reshaper for the first time, you will find a lot of gray code. If you look at the code generated by the designer, you will find that the vertical bars of the Reshaper almost become orange. Basically, you can use Reshaper to slim down your own code and generate a designer, such as a form or dataset.