Skip to content

remove-unused-usings

C#cleanupfix: safedefault: off

Reports a using directive that nothing in the file needs. It is not reported in a file that has compiler errors or #if regions, because unresolved or inactive code could be the one using it. The fix removes the directive.

An unused using adds noise at the top of the file, suggests a dependency that does not exist, and slows the compiler a little. Removing them keeps the list of what the file uses true.

csharp:
lint:
rules:
remove-unused-usings: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line remove-unused-usings in a comment of the file’s language.