ReSharper 2024.1 Help

Code Inspection: Redundant using directive

Category

Redundancies in Code

ID

RedundantUsingDirective

EditorConfig

resharper_redundant_using_directive_highlighting

Default severity

Warning

Language

C#, ASP.NET

Requires SWA

No

Extraneous using directives are a very common thing. Whenever you create, say, a WinForms window, Visual Studio preemptively adds a large number of using directives in your code file. Since ReSharper is able to determine which using references are actually used in the file and which are redundant, it reports the problem, offering an option to remove the unnecessary directives.

If your project is targeting C# 10.0 or later, you may see a using directive highlighted as redundant in a file where symbols from the referenced namespace are actually used. This means that the namespace is referenced elsewhere in the project via a global using directive.

Last modified: 15 April 2024