My current project is working in .NET 3.5 and, of course, I’ve pimped my IDE with some ReSharper goodness. I’ve noticed one thing that is making me itch for the day that ReSharper v4 comes out. If you are using an extension method in your code you need to have a “using” statement for it’s namespace or else the code won’t compile. When ReSharper analyzes the “using” statements it doesn’t pick up that this namespace is being used since it has no idea what extension methods are. As a result the “using” statement is greyed out and if you use Ctrl-Alt-F to reformat and clean you code, it will be removed. Of course you code doesn’t compile then.
To stop this from happening the best thing that I’ve come up with is to turn off the “using” optimization feature in Ctrl-Alt-F by unchecking the first checkbox on the window. The problem with that is that I now don’t clean up any of the unused “using” statements in any of my files. It could be better (I’m guessing ReSharper 4) will take care of this, but I figure that the project is going to go on past the release of ReSharper v4 so I’ll just go back and clean up the dead “using” statements at that time.
Paul Stovell left me a comment that there are a couple of options natively in Visual Studio 2008 that will help me out. I First tried binding a key stroke (Shift-Alt-F was nice and close to the ReSharper Ctrl-Alt-F) to Edit.RemoveUnusedUsings and voila….problem solved. I now leave you to wonder if Paul Stovell is the Thunder From Down Under….