ReSharper Web Help

ReSharper | Options | Code Editing | C# | Namespace Imports

This page contains options that affect the way ReSharper optimizes namespace import directives and resolves references to namespaces when applying quick-fixes or completing the code.

Item Description
Reference Qualification Options in this section define whether ReSharper should resolve references with namespace import directives or fully qualified names.
Insert using directives when necessary Click this radio button to create namespace import directives when referencing a type that has not been imported.
Add using directive to the deepest scope If this check box is selected, namespace import directives are added inside of the namespace.
Prefer fully qualified using name at nested scope If this check box is selected, fully qualified names for namespace imports are preferred at nested scope.
Allow the alias using directive Selecting this check box allows using aliases in namespace import directives, as opposed to fully qualified namespace names.
Use fully qualified names Click this radio button to add a fully qualified path to each unresolved reference.
Allow the 'global::' prefix If this check box is selected, the global:: prefix is automatically added to references, as in global::System.String.
Imports Optimization This section helps configure how ReSharper should handle namespace import directives when running code cleanup.
Do not remove using alias directives if alias name differs from the imported type name If this check box is selected, ReSharper never removes non-trivial alias using directives from the source code, even though they are redundant. If it is cleared, ReSharper removes all redundant using directives.
Namespaces that should not be removed

In this text box, you can list namespaces that ReSharper will not highlight as redundant, and will not remove while running code cleanup.

Use the Add button to add an entry to the list and specify the namespace.

Use the Edit button to edit a namespace entry.

Use the Remove button to delete a selected entry from the list.

Namespaces that should be always imported

In this text box, you can list namespaces that ReSharper should always import while running code cleanup.

Use the Add button to add an entry to the list and specify the namespace.

Use the Edit button to edit a namespace entry.

Use the Remove button to delete a selected entry from the list.

Note

ReSharper's settings are saved in settings layers that enable you to have different settings for different solutions as well as to share your settings with your team. To learn more, study the Managing and Sharing Options section.