Reputation: 17353
There is this option available in Visual Studio 2008.
Is there a similar option in Visual Studio 2005? Or something else that would accomplish such a task? An add-in, maybe?
Upvotes: 0
Views: 665
Reputation: 17271
Resharper can remove the unused 'using' statements. I'm not 100% sure it can also sort them.
Upvotes: 1
Reputation: 20039
If you've got Visual Assist, that's got a 'Sort Selected Lines' command that will do what you need.
Upvotes: 2
Reputation: 22368
Resharper has a sort function. But it looks like all System usings are put on top, and then the rest alphabetically.
Also check this question also on optimizing usings with Resharper.
Upvotes: 1
Reputation: 7943
If you're cleaning up the files with unsorted using
statements once (as opposed to having to deal with them on an on-going basis, perhaps because of a sloppy/uncooperative coworker?), and you are willing to use another tool for the job, there is another option.
I like using VS 2005 for its intellisense, but sometimes find the editor lacking in power compared to Emacs. I have Epsilon (an Emacs clone) which has the command sort-region
, which takes the lines in the current selection and sorts them alphabetically. I can even type in a keyboard macro in Epsilon that:
Upvotes: 1