Removing Unused Using Directives.

  • Thread starter Thread starter J2EE Convert
  • Start date Start date
J

J2EE Convert

After going through about 56 classes today that people on my team have
developed over the last year. I found myself removing on average 7-10
using directives that were not needed in each class sigh.... I decided
that I needed to write an add-in to do this. My question is , how do I
make the decision if an included namespace is being used? Is there a
simple way to do this that anyone has figured out?

Thanks,
PD
 
Is there a simple way to do this that anyone has figured out?
Yes; wait a few weeks, or download VS2008 beta 2 (pro); it includes a
mechanism to do this automatically on a per-file basis - probably
quicker to do this (perhaps finding/assigning the hotkey) on each
class than it is to write the add in. I suspect that power-tools like
resharper will also do this out-of-the-box.

Marc
 
Yep, Resharper does this. Ctrl-Alt-O.

Yes; wait a few weeks, or download VS2008 beta 2 (pro); it includes a
mechanism to do this automatically on a per-file basis - probably
quicker to do this (perhaps finding/assigning the hotkey) on each
class than it is to write the add in. I suspect that power-tools like
resharper will also do this out-of-the-box.

Marc
 
VS2008 beta 2 (pro)
Actually, I just checked, and this option is present even in the
express edition, with the mapping "Edit.RemoveUnusedUsings" if you
want to bind a key-press to it. I know I will ;-p

Marc
 
Actually, I just checked, and this option is present even in the
express edition, with the mapping "Edit.RemoveUnusedUsings" if you
want to bind a key-press to it. I know I will ;-p

Marc

Thanks or all the input folks. Marc you are speaking about VS2008
Express I am assuming?

Thanks,
PD
 
Yes - I'm looking at Visual C# 2008 Express Edition, Version
9.0.20706.1 Beta2

It would be reasonable therefore to hope that it is in the RTM of the
express edition. We'll find out very soon.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top