Did you know… Remove unused using statements? – #240

This was tip #17 in my TechEd VS 2008 IDE Tips and Tricks Talk

In C#, there’s the option to remove any of your unused using statements.  This is especially helpful if you’re reusing some sort of template over and over again.  Instead of having to comment out each line, compile, see whether the compile was successful, then either remove or uncomment the line, you can bring up the editor context menu (just right click in the editor), and choose Organize Usings – Remove Unused Usings.  This will do all the hard work for you.


Technorati Tags: VS2008Tip

Comments (4)

  1. Zack Owens says:

    Is there a key combo for this? It would be nice if I could, say, click Alt + ctr + f10 or something cool. Just a thought.

  2. fars1d3r says:

    In addition to removing the unused Usings you can also Sort them – is there any good reason to sort them ?  Does it improve performance on compiles or object loading or is just prettier ?

  3. Tom Meschter (MS) says:


    There are no default shortcuts for these, but you can add your own. Go to the "ToolsOptions…" menu option, and open up the "EnvironmentKeyboard" options page.

    The commands are:





    MSFT, C# IDE

  4. Tom Meschter (MS) says:


    Sorting the usings doesn’t do anything but make them easier to look through. As it will effectively group related namespaces (e.g., all the System.* namespaces will end up next to each other) it can make it much easier to scan through a long list of "usings".


    MSFT, C# IDE

Skip to main content