BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Visual Studio
VS 2008+

Visual Studio 2008 Organize Usings Command

When creating new code files or designers that include code behind the design window, using statements are added automatically. With the Organize Usings command, redundant using commands can be automatically removed and the remaining items can be sorted.

Organize Usings Menu

The Organize Usings menu is useful for automatically sorting the using commands at the start of a code file. It can also be used for removing usings that are not needed, either because they were added automatically and not used or because the code that did require them has been removed or relocated. The menu is displayed by right-clicking the code area and pointing at "Organize Usings". The same menu can also be found in the IntelliSense section of the Edit menu.

Once visible, three commands are available. These are:

  • Remove Unused Usings. This option removes any redundant using commands from the current code file. Visual Studio examines the contents of the file to determine which using commands are required and which are unused before modifying the code.
  • Sort Usings. This option simply sorts the using directives into alphabetical order.
  • Remove and Sort. The final organisation option on the menu combines the activities of the previous two commands. It removes unnecessary using directives and sorts the remaining commands in a single step.

Visual Studio Organize Usings Menu

9 May 2008