I’ve been using R# from Jet Brains extension for Visual Studio for about three years and consider it a critical part of the IDE. In fact, when I consider using a beta or release candidate build of Visual Studio, my first question is whether or not R# is available for use in the new version. After using this tool for only a short period of time, our team noticed the quality of our code improve quite drastically and even learned some best practices that we were unaware of from the suggestions.
R# has a nice visual indicator down the side of all your code files that indicates if there are any issue or possible refactorings that it suggests based on its code inspections (according to their site there are over 1300 different inspections):

You can see in this shot that R# is telling us on the right side of the code file that there are warnings in this file. The yellow dash about halfway down indicates where on the scroll of the page the warning resides. There is also a high-level assessment of the quality of the code file as an indicator at the top of this bar.
Clicking this dash quickly shows you the unused variable and gives you options for fixing this issue. In this case we remove the unused variable and the visual indicator for the file shows a green check mark (all clear).
As a general rule, our team tries to keep all of the files we check-in to our source repository “green” so that R# is happy. Sometimes we may have a need to ignore an inspection, but in these cases we usually tell R# to suppress the warning so that the code file remains in the green state. This tells others down the road that we considered the warning and allowed it intentionally. In these cases we may even add a comment to indicate why we ignored the suggestion.
I think it’s important to note here that most refactorings R# suggests are great and should be accepted. Occasionally it seems to suggest something that doesn’t make sense or actually causes a compilation or runtime issue. These are extremely rare. However just keep in mind that R# is just a tool to help improve your code, it can’t actually write if for you so you need to review the suggested changes before making them and verify that all your unit tests still pass.
When we first started using R#, our solution was already quite large with several projects and lots of code artifacts. At first the number of warnings (and even errors) was a little overwhelming. Instead of tackling all of these in mass, we decided to follow the boy-scout rule (leave the campground cleaner than you found it) and made sure that we fixed any files as we worked on them. Each time we modified a file, we would make the necessary changes to turn the R# indicator green (a happy R# makes for a clean code base). Gradually the quality of our code base improved and over time the change was dramatic.
Tip – If you’re just starting to use R# with an existing code base, don’t let the inspections overwhelm you. Just fix the files gradually as you modify and review them for feature releases. You can use R#’s code cleanup functionality to do a lot of this work for a file without having to address all of the inspection results individually.
R# also abounds with refactorings to help you quickly refactor your existing code. Just right clicking on a section of code gives you a list of refactorings you can perform on that code. We’ve found that these automated refactorings significantly improve our development efficiency.
I have also found the key board shortcuts that R# adds to Visual Studio to be extremely helpful. I use the Visual Studio Scheme for keyboard shortcuts.
Some of my favorite keyboard shortcuts in the Visual Studio Scheme:
- Ctrl+R+R – Rename – Renames whatever is in the current context. If any code in your solution refers to this item then it fixes those references as well. It will even search through text files looking for text references to fix. This makes renaming lexical items *much* easier. This is great because good naming is one of the hardest parts of development that is rarely done right the first time.
- Alt+Enter – Show available quick fixes – If you’re on code that a R# suggestion is referencing then you can just click Alt+Enter to get a quick menu of recommended changes.
- Alt+Shift+L – Find in Solution Explorer – How many times have you been editing a file and then tried to find it in Solution Explorer. This shortcut opens the folder and highlights the file you are editing.
- Ctrl+U+R – Run unit tests – This is a context sensitive shortcut to run unit tests. If you are in a unit test, it runs that one. If you are outside the method, but in the class it will run all tests in the class. If you have the solution in focus it will run all the tests in the solution.
- Ctrl+T – Go to type – Makes it very easy to quickly find types in your solution.
- Ctrl+Shift+T – Quickly got to a file in your solution – Makes it easy to quickly find files.
- Ctrl+Shift+R – Bring up the refactoring context menu
- Ctrl+E+C – Code cleanup – Uses a profile to apply general code cleanup inspections on a file. Very useful for bulk fixing a lot of files
There are tons of other really good shortcuts. Here is the full list on Jet Brains website.
Unit Testing
We use NUnit as our unit testing framework. R# comes with built in support for running NUnit and MSTest tests. It automatically detects these when you tell it to run tests and uses the current context to determine which tests to run. The test runner is very fast and well integrated. There are also R# plugins for other unit testing frameworks.
Conclusion
I’ve been using R# for quite a while and it’s been greatly improving my productivity and code quality. I would strongly recommend it to other developers. Happy coding!