#1,213 – Visual Studio 2015 – Unused using Statements Greyed Out

In Visual Studio 2015, the editor will grey out any using statements that are not required.  This is done at build time.  Note that you can still use the Remove Unused Usings command to remove any unused statements.  (This command has been renamed Remove Unnecessary Usings).

Below, all but the first using statement is greyed out, since the code that follows makes no use of types from any of the other namespaces.

1213-001

 

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

8 Responses to #1,213 – Visual Studio 2015 – Unused using Statements Greyed Out

  1. Dimitri says:

    Like ReSharper ))

  2. Pingback: Dew Drop – October 28, 2014 (#1886) | Morning Dew

  3. That’s handy! I used the Remove Unused Usings command a few times yesterday, and it got rid of all of the usings, haha…
    Do you know if there’s a command to remove the usings across all of the project files? Would be easier than doing each one individually.

    • Sean says:

      Right–now that the option is baked into Visual Studio, it’s one less reason to need Resharper. Note that for many large production codebases, Resharper is unusable because it slows Visual Studio and the compile/run/debug loop down too much to be effective.

  4. visualstuart says:

    Hover over an unnecessary using directive (or type Ctrl+,) to display the Quick Actions SmartTip. From the SmartTip drop-down list, select Remove Unnecessary Usings. At the bottom of the details popup, select to fix all occurrences in the Document, Project, or Solution.

Leave a comment