Tuesday, February 8, 2011

Tool to optimize C# using statements?

Is there any tool out there that can identify name spaces in the Using statement that are not needed and eliminate them from the source?

  • Resharper

  • Visual Studio 2008 does this, and I believe that Refactor Pro from DevExpress (as Consolidate Usings) has this as a refactoring.

  • The Visual Studio Power Pack will do it ofr the whole project at once. There's also a way to enable it in VS2005 via the registry.

  • Resharper, Refactor Pro!, Visual Studio 2008 now does this.

    In VS2008 if you right click in the text of the file and choose the option Organize usings then select one of the options. It will remove and or sort the using statements.

    PowerCommands for Visual Studio also does this.

    MikeJ : thank you. I guess I have put off installing vs 2008 long enough.
    MikeJ : this is great. thanks to everyone who took the time to help me out.
  • Code Rush with Refactor Pro does this. There is a light weight version of this built into Visual Studio 2008 which should do it for you. Highlight the namespaces and then right click them, then click refactor, and there should be an option to remove or re-order the usings.

  • Visual Studio 2008 PowerCommands can do this for a file at a time, or for an entire solution at once.

    From Kyralessa

0 comments:

Post a Comment