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?
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?
Resharper can remove the unused 'using' statements. I'm not 100% sure it can also sort them.
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:
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.
If you've got Visual Assist, that's got a 'Sort Selected Lines' command that will do what you need.