This post is just a simple tip that barely begins to touch on the added convenience of ReSharper’s on-the-fly code analysis and the usefulness of Quick-Fixes.
The following example was lifted off ReSharper Early Access Program newsgroup where users can discuss their experience with the latest builds of ReSharper. By the way, we’re about to release a bugfix update, so don’t change the channel.
Consider the following setup. You need a switch statement for an
As soon as you type the braces of the switch block, a Quick-Fix becomes available which can generate the appropriate switch labels for you. You could ask, “What is there to fix?” as you are meaning to supply them by hand, anyway. Programming by intention or not, the Quick-Fix is there and it can save you some time, so why not use it?
Press Alt + Enter to bring up the available quick-fixes (just one in this case), then select the right one:
Immediately after, the case stubs are generated for you. All values of the enumerated type are included and a break statement is supplied for you to add to.
There are lots of this kind of things available in Quick-Fixes and Context Actions (new in ReSharper 2.0). We’re going to talk about those pretty soon.
Please send in your suggestions for post topics and requests for tips and tricks. We’ll listen.